38 lines
887 B
JavaScript
38 lines
887 B
JavaScript
import PropTypes from "prop-types";
|
|
|
|
function FormSelect({ value, onChange, options, className }) {
|
|
return (
|
|
<select
|
|
value={value}
|
|
className={
|
|
"w-1/2 md:w-1/3 lg:w-1/4 h-10 px-2 rounded-full dark:bg-white dark:text-grey border-2 text-grey focus:outline-grey " +
|
|
className
|
|
}
|
|
onChange={onChange}
|
|
>
|
|
<option disabled value="">
|
|
Select
|
|
</option>
|
|
{options.map(({ value, label }) => (
|
|
<option key={value} value={value}>
|
|
{label}
|
|
</option>
|
|
))}
|
|
</select>
|
|
);
|
|
}
|
|
|
|
FormSelect.propTypes = {
|
|
value: PropTypes.string.isRequired,
|
|
onChange: PropTypes.func.isRequired,
|
|
className: PropTypes.string,
|
|
options: PropTypes.arrayOf(
|
|
PropTypes.shape({
|
|
value: PropTypes.string.isRequired,
|
|
label: PropTypes.string.isRequired,
|
|
})
|
|
).isRequired,
|
|
};
|
|
|
|
export default FormSelect;
|