// The strip that appears above a table once rows are checked, in the shape the // project list and the plantafel established: a count badge, the actions, and // the way out of the selection. // // Pure/presentational. It renders nothing while the selection is empty, so a // screen cannot end up reserving room for a bar that has nothing to act on. // Captions come in resolved, keeping this free of i18n lookups. import type { ReactNode } from "react"; import { BadgeFeedback } from "~/ui/components/BadgeFeedback"; import { Button } from "~/ui/components/Button"; export type BulkActionBarProps = { /** How many rows are checked. Zero renders nothing at all. */ selectedCount: number; /** Resolved caption stating the count, e.g. "3 Kontakte ausgewählt". */ countLabel: string; /** * Resolved note about the part of the selection that is not on screen. A * selection spanning pages is otherwise unreviewable: the reader cannot see * what the action would touch. */ offPageLabel?: string | null; /** The actions themselves — buttons, in the order they should be offered. */ children: ReactNode; /** Resolved caption of the button that drops the selection. */ clearLabel: string; onClear: () => void; disabled?: boolean; uiId: string; }; export function BulkActionBar(props: BulkActionBarProps) { if (props.selectedCount <= 0) return null; return (
{props.countLabel} {props.offPageLabel ? ( {props.offPageLabel} ) : null} {props.children}
); } export default BulkActionBar;