mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 21:50:35 +02:00
Add filter functionality for infinite album list
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import { Dispatch } from 'react';
|
||||
import { ActionIcon, Menu, MenuProps } from '@mantine/core';
|
||||
import { LayoutGrid, LayoutList, Table } from 'tabler-icons-react';
|
||||
|
||||
export enum ViewType {
|
||||
Detail = 'detail',
|
||||
Grid = 'grid',
|
||||
Table = 'table',
|
||||
}
|
||||
|
||||
interface ViewTypeButtonProps {
|
||||
handler: Dispatch<ViewType>;
|
||||
menuProps: MenuProps;
|
||||
type: ViewType;
|
||||
}
|
||||
|
||||
export const ViewTypeButton = ({
|
||||
type,
|
||||
menuProps,
|
||||
handler,
|
||||
}: ViewTypeButtonProps) => {
|
||||
return (
|
||||
<Menu {...menuProps}>
|
||||
<Menu.Target>
|
||||
<ActionIcon variant="transparent">
|
||||
{type === ViewType.Grid ? (
|
||||
<LayoutGrid />
|
||||
) : type === ViewType.Detail ? (
|
||||
<LayoutList />
|
||||
) : (
|
||||
<Table />
|
||||
)}
|
||||
</ActionIcon>
|
||||
</Menu.Target>
|
||||
<Menu.Dropdown>
|
||||
<Menu.Item
|
||||
icon={<LayoutGrid size={14} />}
|
||||
onClick={() => handler(ViewType.Grid)}
|
||||
>
|
||||
Grid
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
icon={<LayoutList size={14} />}
|
||||
onClick={() => handler(ViewType.Detail)}
|
||||
>
|
||||
Detail
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
icon={<Table size={14} />}
|
||||
onClick={() => handler(ViewType.Table)}
|
||||
>
|
||||
Table
|
||||
</Menu.Item>
|
||||
</Menu.Dropdown>
|
||||
</Menu>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user