AbdulElahGwaith's picture
Upload folder using huggingface_hub
84c1942 verified
Raw
History Blame Contribute Delete
690 Bytes
import React, { ChangeEvent, FunctionComponent } from 'react';
import { Select } from '@codesandbox/components';
type Props = {
mapName?: (param: string) => string;
options: string[];
setValue: (value: string) => void;
value: string;
};
export const PreferenceDropdown: FunctionComponent<Props> = ({
mapName,
options,
setValue,
value,
}) => {
const handleChange = ({ target }: ChangeEvent<any>) => {
setValue(target.value);
};
return (
<Select onChange={handleChange} value={value}>
{options.map(option => (
<option key={option} value={option}>
{mapName ? mapName(option) : option}
</option>
))}
</Select>
);
};