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