2024-06-15 21:02:46 +05:30
|
|
|
import React from 'react';
|
|
|
|
|
import { FormControl, InputLabel, Select } from "@mui/material";
|
|
|
|
|
import { SelectChangeEvent } from "@mui/material/Select/Select";
|
2024-09-12 22:44:59 +05:30
|
|
|
import { SxProps } from '@mui/system';
|
2024-06-15 21:02:46 +05:30
|
|
|
|
|
|
|
|
interface DropdownProps {
|
|
|
|
|
id: string;
|
|
|
|
|
label: string;
|
|
|
|
|
value: string | undefined;
|
|
|
|
|
handleSelect: (event: SelectChangeEvent) => void;
|
2024-06-15 21:09:37 +05:30
|
|
|
children?: React.ReactNode;
|
2024-09-12 22:44:59 +05:30
|
|
|
sx?: SxProps;
|
2024-06-15 21:02:46 +05:30
|
|
|
};
|
|
|
|
|
|
2024-09-12 22:44:59 +05:30
|
|
|
export const Dropdown = ({ id, label, value, handleSelect, children, sx }: DropdownProps) => {
|
2024-06-15 21:02:46 +05:30
|
|
|
return (
|
2024-09-12 23:00:36 +05:30
|
|
|
<FormControl sx={sx} size="small">
|
2024-06-15 21:02:46 +05:30
|
|
|
<InputLabel id={id}>{label}</InputLabel>
|
|
|
|
|
<Select
|
|
|
|
|
labelId={id}
|
2024-06-15 21:09:37 +05:30
|
|
|
name={id}
|
2024-06-15 21:02:46 +05:30
|
|
|
value={value}
|
|
|
|
|
label={label}
|
|
|
|
|
onChange={handleSelect}
|
|
|
|
|
size='small'
|
2024-09-12 22:44:59 +05:30
|
|
|
sx={sx}
|
2024-06-15 21:02:46 +05:30
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</Select>
|
|
|
|
|
</FormControl>
|
|
|
|
|
);
|
|
|
|
|
};
|