owner-select.tsx
This file
Path
apps/web/src/features/import/owner-select.tsx
47 lines · 1.0 KiB · TypeScript
Last changed by
Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue,} from "../../components/ui/select.tsx";import { TRIGGER } from "./client-owner.tsx";import type { OwnerSelectProps } from "./client-owner.tsx";
export const OwnerSelect = ({ choices, describedBy, labelledBy, onChange, value,}: OwnerSelectProps) => ( <Select items={choices.map((choice) => ({ label: choice, value: choice }))} name="owner" onValueChange={(chosen) => { const owner = choices.find((choice) => choice === chosen);
if (owner !== undefined) { onChange(owner); } }} value={value} > <SelectTrigger aria-describedby={describedBy} aria-labelledby={labelledBy} className={TRIGGER} > <SelectValue /> </SelectTrigger> <SelectContent> {choices.map((choice) => ( <SelectItem key={choice} value={choice}> {choice} </SelectItem> ))} </SelectContent> </Select>);
export default OwnerSelect;