All files / src/features/items ItemFilterPills.tsx

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16        3x       22x     66x        
import { FilterPills } from "@/components/ui";
import { viewHref } from "@/components/ui/viewHref";
 
export type ItemsView = "all" | "archived" | "unnamed";
const PILLS: [ItemsView, string][] = [["all", "All"], ["archived", "Archived"], ["unnamed", "Waiting for a name"]];
 
/** `path` is the list's own path (the collection home since PR 3). */
export function ItemFilterPills({ path, view, q }: { path: string; view: ItemsView; q: string }) {
  return (
    <FilterPills
      label="Filter items"
      pills={PILLS.map(([v, label]) => ({ label, href: viewHref(path, v, q), current: v === view }))}
    />
  );
}