feat: add asset filter chips
This commit is contained in:
parent
57c337e0a9
commit
f3f09d9c05
22
app/components/assets/list/asset-filter-chips.tsx
Normal file
22
app/components/assets/list/asset-filter-chips.tsx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { FilterChip } from '~/components/ui/filter-chip';
|
||||||
|
import { ASSET_FILTER } from '~/data/assets/constants';
|
||||||
|
import { ROUTES } from '~/data/routes';
|
||||||
|
import type { ProjectSummary } from '~/types/project';
|
||||||
|
|
||||||
|
export function AssetFilterChips({ filter, projects }: { filter: string; projects: ProjectSummary[] }) {
|
||||||
|
const chips = [
|
||||||
|
{ value: ASSET_FILTER.all, label: 'All', to: ROUTES.assets },
|
||||||
|
...projects.map((project) => ({ value: project.id, label: project.name, to: ROUTES.assetsFiltered(project.id) })),
|
||||||
|
{ value: ASSET_FILTER.unassigned, label: 'Unassigned', to: ROUTES.assetsFiltered(ASSET_FILTER.unassigned) },
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<nav aria-label='Filter assets' className='flex flex-wrap gap-2'>
|
||||||
|
{chips.map((chip) => (
|
||||||
|
<FilterChip key={chip.value} to={chip.to} selected={filter === chip.value}>
|
||||||
|
{chip.label}
|
||||||
|
</FilterChip>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user