handle translation AND onChange reture string

This commit is contained in:
MathieuG-P
2022-12-10 01:29:23 +01:00
parent c5f871d810
commit 1ca62ba2f5
@@ -1,14 +1,17 @@
import { ChangeEvent, CSSProperties } from "react"
import { useTranslation } from "renderer/hooks/use-translation.hook"
type Props = {
className?: string,
style?: CSSProperties,
options?: BsmSelectOption[],
onChange?: (value: any) => void
onChange?: (value: string) => void
}
export function BsmSelect({className, style, options, onChange}: Props) {
const t = useTranslation();
const handleChange = (event: ChangeEvent<HTMLSelectElement>) => {
onChange?.(event.target.value);
}
@@ -16,7 +19,7 @@ export function BsmSelect({className, style, options, onChange}: Props) {
return (
<select className={className} style={style} onChange={handleChange}>
{options && options.map(option => (
<option key={option.value} value={option.value}>{option.text}</option>
<option key={option.value} value={option.value}>{t(option.text)}</option>
))}
</select>
)