From b1fb2561897a09f5c7c6390e9bb4e172d9f3c95b Mon Sep 17 00:00:00 2001 From: rishighan Date: Thu, 3 Nov 2022 12:47:31 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Streamlined=20search=20and=20pag?= =?UTF-8?q?ination=20controls=20on=20Library=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/assets/scss/App.scss | 33 +++++++------- src/client/components/Library/Library.tsx | 50 ++++++++++----------- src/client/components/Library/SearchBar.tsx | 2 +- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/client/assets/scss/App.scss b/src/client/assets/scss/App.scss index 5719a76..6ca5886 100644 --- a/src/client/assets/scss/App.scss +++ b/src/client/assets/scss/App.scss @@ -410,32 +410,33 @@ pre { } } // Library -.sticky { - background: #fffffc; - position: sticky; - top: 40px; - z-index: 5; - - .title { - background: #fffffc; - position: relative; - top: 0px; - z-index: 99999; - padding-top: 20px; - } -} .header-area { width: 100%; - padding: 10px 0 15px 0; + padding: 25px 0 15px 0; + position: sticky; + background: #fffffc; + top: 50px; } .library { + .table-controls { + background: #fffffc; + justify-content: space-between; + position: sticky; + top: 126px; + padding-bottom: 10px; + } + .pagination { + margin: 0; + background: #fffffc; + } + table { border-collapse: separate; width: 100%; thead { position: sticky; - top: 216px; + top: 250px; z-index: 1; background: #fffffc; min-height: 130px; diff --git a/src/client/components/Library/Library.tsx b/src/client/components/Library/Library.tsx index dda06f0..7c78402 100644 --- a/src/client/components/Library/Library.tsx +++ b/src/client/components/Library/Library.tsx @@ -8,7 +8,6 @@ import { useDispatch, useSelector } from "react-redux"; import { searchIssue } from "../../actions/fileops.actions"; import ellipsize from "ellipsize"; - import { ColumnDef, flexRender, @@ -63,8 +62,6 @@ export const Library = (): ReactElement => { const { columns, totalPages, rowClickHandler } = tableOptions; - - // pagination methods const goToNextPage = useCallback(() => { setPagination({ @@ -93,7 +90,7 @@ export const Library = (): ReactElement => { setPagination({ pageIndex: pageIndex - 1, pageSize, - }); + }); let from = 0; if (pageIndex === 2) { from = (pageIndex - 1) * pageSize + 2 - 17; @@ -117,9 +114,6 @@ export const Library = (): ReactElement => { ); }, []); - - - const table = useReactTable({ data: searchResults.hits.hits, columns, @@ -130,25 +124,32 @@ export const Library = (): ReactElement => { pagination, }, onPaginationChange: setPagination, - // getPaginationRowModel: getPaginationRowModel(), - - debugTable: true, }); return ( <> - {/* pagination control */} - + {/* pagination control */} + + {table.getHeaderGroups().map((headerGroup, idx) => ( @@ -261,7 +262,7 @@ export const Library = (): ReactElement => { !isEmpty(info.getValue()) ? ( ) : ( - No ComicInfo.xml + No ComicInfo.xml ), }, ], @@ -303,11 +304,8 @@ export const Library = (): ReactElement => { return (
-
+

Library

- {/* Search bar */} - -
{!isUndefined(searchResults.hits) && (
diff --git a/src/client/components/Library/SearchBar.tsx b/src/client/components/Library/SearchBar.tsx index 39d2190..6b133f0 100644 --- a/src/client/components/Library/SearchBar.tsx +++ b/src/client/components/Library/SearchBar.tsx @@ -27,7 +27,7 @@ export const SearchBar = (): ReactElement => { ); }, []); return ( -
+