26 lines
549 B
TypeScript
26 lines
549 B
TypeScript
import { useI18n } from '@/context/i18n-provider';
|
|
import { Select, SelectProps } from '@pikku/mantine/core';
|
|
|
|
interface EnumSelectProps extends Omit<SelectProps, 'data'> {
|
|
enumObject: Record<string, string>;
|
|
enumName: string;
|
|
label?: any;
|
|
placeholder?: any;
|
|
}
|
|
|
|
export const EnumSelect: React.FC<EnumSelectProps> = ({
|
|
enumObject,
|
|
enumName,
|
|
...selectProps
|
|
}) => {
|
|
const t = useI18n()
|
|
const options = t.getEnumOptions(enumObject, enumName);
|
|
|
|
return (
|
|
<Select
|
|
{...(selectProps as any)}
|
|
data={options}
|
|
/>
|
|
);
|
|
};
|