From a5efd28a69a784bfcdf28e8f8b24af58f553e18c Mon Sep 17 00:00:00 2001 From: jeffvli Date: Thu, 5 Aug 2021 04:48:13 -0700 Subject: [PATCH] Add page headers --- src/components/layout/GenericPageHeader.tsx | 58 +++++++++++++++++++++ src/components/playlist/PlaylistList.tsx | 48 ++++++++++++----- src/styles/GenericPage.global.css | 10 +++- 3 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 src/components/layout/GenericPageHeader.tsx diff --git a/src/components/layout/GenericPageHeader.tsx b/src/components/layout/GenericPageHeader.tsx new file mode 100644 index 0000000..2879158 --- /dev/null +++ b/src/components/layout/GenericPageHeader.tsx @@ -0,0 +1,58 @@ +import React, { useState } from 'react'; +import { + IconButton, + ButtonGroup, + ButtonToolbar, + Icon, + Input, + InputGroup, +} from 'rsuite'; + +const GenericPageHeader = ({ + title, + tags, + handleSearch, + showViewTypeButtons, +}: any) => { + return ( + <> +
+ +

{title}

+
+ + + + + + + + +
+
+ {tags} + {showViewTypeButtons && ( + + + + } appearance="link" /> + } appearance="link" /> + + + + )} +
+ + ); +}; + +export default GenericPageHeader; diff --git a/src/components/playlist/PlaylistList.tsx b/src/components/playlist/PlaylistList.tsx index 7881a95..d47dd71 100644 --- a/src/components/playlist/PlaylistList.tsx +++ b/src/components/playlist/PlaylistList.tsx @@ -1,10 +1,13 @@ -import React from 'react'; +import React, { useState } from 'react'; import { useQuery } from 'react-query'; import { useHistory } from 'react-router-dom'; +import { Tag } from 'rsuite'; + import { getPlaylists } from '../../api/api'; import ListViewType from '../viewtypes/ListViewType'; import Loader from '../loader/Loader'; import GenericPage from '../layout/GenericPage'; +import GenericPageHeader from '../layout/GenericPageHeader'; const tableColumns = [ { @@ -42,12 +45,17 @@ const PlaylistList = () => { 'playlists', getPlaylists ); + const [searchQuery, setSearchQuery] = useState(''); const history = useHistory(); const handleRowClick = (e: any) => { history.push(`playlist/${e.id}`); }; + const handleSearch = (e: any) => { + setSearchQuery(e); + }; + if (isLoading) { return ; } @@ -57,21 +65,35 @@ const PlaylistList = () => { } return ( - Playlists}> + {playlists.length} playlists} + handleSearch={handleSearch} + showViewTypeButtons + /> + } + > { + return ( + playlist.name + .toLowerCase() + .includes(searchQuery.toLowerCase()) || + playlist.comment + ?.toLowerCase() + .includes(searchQuery.toLowerCase()) + ); + }) + } handleRowClick={handleRowClick} tableColumns={tableColumns} - virtualized={false} - autoHeight - > - {/* - Actions - - - - */} - + virtualized + /> ); }; diff --git a/src/styles/GenericPage.global.css b/src/styles/GenericPage.global.css index d009dc5..f25b3f7 100644 --- a/src/styles/GenericPage.global.css +++ b/src/styles/GenericPage.global.css @@ -1,3 +1,11 @@ .container__page { - padding: 1rem 1rem 6rem 1rem; + padding: 0px 0px 95px 0px; +} + +.page__header { + padding: 20px 20px 0px 20px; +} + +.page__content { + padding: 10px; }