mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 21:35:19 +00:00
19 lines
647 B
TypeScript
19 lines
647 B
TypeScript
import { Currency } from "@prisma/client"
|
|
import { SelectProps } from "@radix-ui/react-select"
|
|
import { useMemo } from "react"
|
|
import { FormSelect } from "./simple"
|
|
|
|
export const FormSelectCurrency = ({
|
|
title,
|
|
currencies,
|
|
emptyValue,
|
|
placeholder,
|
|
...props
|
|
}: { title: string; currencies: Currency[]; emptyValue?: string; placeholder?: string } & SelectProps) => {
|
|
const items = useMemo(
|
|
() => currencies.map((currency) => ({ code: currency.code, name: `${currency.code} - ${currency.name}` })),
|
|
[currencies]
|
|
)
|
|
return <FormSelect title={title} items={items} emptyValue={emptyValue} placeholder={placeholder} {...props} />
|
|
}
|