Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
feature: added select for admin pages
Browse files Browse the repository at this point in the history
  • Loading branch information
igaryakqwe committed Jan 4, 2024
1 parent e147042 commit 41cfc3f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import { SxProps, Theme } from '@mui/material/styles';
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { FC } from 'react';
import {
FormControl,
InputLabel,
MenuItem,
OutlinedInput,
Select,
SelectChangeEvent,
} from '@mui/material';

import * as styles from './TeachersAdminSelect.styles';

const ITEM_HEIGHT = 48;
const ITEM_PADDING_TOP = 8;
const MenuProps = {
PaperProps: {
style: {
maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
width: 250,
},
},
};

interface TeachersAdminSelectProps {
value: string;
values: string[];
handleChange: (event: SelectChangeEvent) => void;
}

const TeachersAdminSelect: FC<TeachersAdminSelectProps> = ({
value,
values,
handleChange,
}) => {
return (
<FormControl sx={{ m: 1, width: 300 }}>
<InputLabel id="demo-multiple-name-label">Name</InputLabel>
<Select
labelId="demo-multiple-name-label"
id="demo-multiple-name"
multiple
value={value}
onChange={handleChange}
input={<OutlinedInput label="Name" />}
MenuProps={MenuProps}
>
{values.map(name => (
<MenuItem key={name} value={name}>
{name}
</MenuItem>
))}
</Select>
</FormControl>
);
};

export default TeachersAdminSelect;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './TeachersAdminSelect';

0 comments on commit 41cfc3f

Please sign in to comment.