feishin/src/renderer/features/playlists/components/playlist-list-header.tsx

55 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-12-31 03:46:12 -08:00
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
import { Flex, Group, Stack } from '@mantine/core';
2023-02-05 22:41:47 -08:00
import { MutableRefObject } from 'react';
import { PageHeader, SpinnerIcon, Paper } from '/@/renderer/components';
import { PlaylistListHeaderFilters } from '/@/renderer/features/playlists/components/playlist-list-header-filters';
import { LibraryHeaderBar } from '/@/renderer/features/shared';
2022-12-31 03:46:12 -08:00
import { useContainerQuery } from '/@/renderer/hooks';
interface PlaylistListHeaderProps {
2023-02-05 22:41:47 -08:00
itemCount?: number;
2022-12-31 03:46:12 -08:00
tableRef: MutableRefObject<AgGridReactType | null>;
}
2023-02-05 22:41:47 -08:00
export const PlaylistListHeader = ({ itemCount, tableRef }: PlaylistListHeaderProps) => {
2022-12-31 03:46:12 -08:00
const cq = useContainerQuery();
return (
2023-02-05 22:41:47 -08:00
<Stack
ref={cq.ref}
spacing={0}
>
<PageHeader backgroundColor="var(--titlebar-bg)">
2022-12-31 03:46:12 -08:00
<Flex
2023-02-05 22:41:47 -08:00
justify="space-between"
py="1rem"
2022-12-31 03:46:12 -08:00
>
2023-02-05 22:41:47 -08:00
<LibraryHeaderBar>
<Group>
<LibraryHeaderBar.Title>Playlists</LibraryHeaderBar.Title>
</Group>
<Paper
fw="600"
px="1rem"
py="0.3rem"
radius="sm"
>
{itemCount === null || itemCount === undefined ? <SpinnerIcon /> : itemCount}
</Paper>
</LibraryHeaderBar>
2022-12-31 03:46:12 -08:00
</Flex>
2023-02-05 22:41:47 -08:00
</PageHeader>
<Paper
p="1rem"
shadow="xl"
sx={{
boxShadow: '1px 1px 10px 5px rgba(0, 0, 0, 0.3)',
zIndex: 100,
}}
>
<PlaylistListHeaderFilters tableRef={tableRef} />
</Paper>
</Stack>
2022-12-31 03:46:12 -08:00
);
};