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
Merge build/1411-web-import into mainoscabrielbefore adoption059c75c
lines 1–47why, one step back1import {2 Select,3 SelectContent,4 SelectItem,5 SelectTrigger,6 SelectValue,7} from "../../components/ui/select.tsx";8import { TRIGGER } from "./client-owner.tsx";9import type { OwnerSelectProps } from "./client-owner.tsx";1011export const OwnerSelect = ({12 choices,13 describedBy,14 labelledBy,15 onChange,16 value,17}: OwnerSelectProps) => (18 <Select19 items={choices.map((choice) => ({ label: choice, value: choice }))}20 name="owner"21 onValueChange={(chosen) => {22 const owner = choices.find((choice) => choice === chosen);2324 if (owner !== undefined) {25 onChange(owner);26 }27 }}28 value={value}29 >30 <SelectTrigger31 aria-describedby={describedBy}32 aria-labelledby={labelledBy}33 className={TRIGGER}34 >35 <SelectValue />36 </SelectTrigger>37 <SelectContent>38 {choices.map((choice) => (39 <SelectItem key={choice} value={choice}>40 {choice}41 </SelectItem>42 ))}43 </SelectContent>44 </Select>45);4647export default OwnerSelect;