Add order toggle button component

This commit is contained in:
jeffvli 2023-07-15 11:18:18 -07:00
parent 734b632c6c
commit 8129a3994b
2 changed files with 39 additions and 5 deletions

View File

@ -0,0 +1,33 @@
import { ButtonProps } from '@mantine/core';
import { RiSortAsc, RiSortDesc } from 'react-icons/ri';
import { SortOrder } from '/@/renderer/api/types';
import { Button, Tooltip } from '/@/renderer/components';
interface OrderToggleButtonProps {
buttonProps?: Partial<ButtonProps>;
onToggle: () => void;
sortOrder: SortOrder;
}
export const OrderToggleButton = ({ sortOrder, onToggle, buttonProps }: OrderToggleButtonProps) => {
return (
<Tooltip label={sortOrder}>
<Button
compact
fw="600"
size="md"
variant="subtle"
onClick={onToggle}
{...buttonProps}
>
<>
{sortOrder === SortOrder.ASC ? (
<RiSortAsc size="1.3rem" />
) : (
<RiSortDesc size="1.3rem" />
)}
</>
</Button>
</Tooltip>
);
};

View File

@ -1,11 +1,12 @@
export * from './components/animated-page';
export * from './queries/music-folders-query';
export * from './components/play-button';
export * from './utils';
export * from './components/filter-bar';
export * from './components/library-header';
export * from './components/library-header-bar';
export * from './components/order-toggle-button';
export * from './components/play-button';
export * from './components/resize-handle';
export * from './mutations/create-favorite-mutation';
export * from './mutations/delete-favorite-mutation';
export * from './mutations/set-rating-mutation';
export * from './components/filter-bar';
export * from './components/resize-handle';
export * from './queries/music-folders-query';
export * from './utils';