source: phonelux-frontend/src/components/FiltersComponents/FilterSelectComponent.js@ dfd5d87

Last change on this file since dfd5d87 was dfd5d87, checked in by Marko <Marko@…>, 22 months ago

Registration logic with confirmation token implemented

  • Property mode set to 100644
File size: 1.9 KB
Line 
1import * as React from 'react';
2import OutlinedInput from '@mui/material/OutlinedInput';
3import InputLabel from '@mui/material/InputLabel';
4import MenuItem from '@mui/material/MenuItem';
5import FormControl from '@mui/material/FormControl';
6import ListItemText from '@mui/material/ListItemText';
7import Select from '@mui/material/Select';
8import Checkbox from '@mui/material/Checkbox';
9import "./FilterSelectComponent.css"
10
11const ITEM_HEIGHT = 48;
12const ITEM_PADDING_TOP = 8;
13const MenuProps = {
14 PaperProps: {
15 style: {
16 maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
17 width: 250,
18 },
19 },
20};
21
22const categories = [
23 'Category1',
24 'Category2',
25 'Category3',
26 'Category4',
27 'Category5',
28 'Category6',
29 'Category7',
30 'Category8',
31 'Category9',
32 'Category10',
33];
34
35export default function MultipleSelectCheckmarks() {
36 const [category, setCategory] = React.useState([]);
37
38 const handleChange = (event) => {
39 const {
40 target: { value },
41 } = event;
42 setCategory(
43 // On autofill we get a stringified value.
44 typeof value === 'string' ? value.split(',') : value,
45 );
46 };
47
48 return (
49 <div>
50 <FormControl id="form" sx={{ m: 1, width: 200 }}>
51 <InputLabel id="demo-multiple-checkbox-label">Category</InputLabel>
52 <Select
53 size={"small"}
54 labelId="demo-multiple-checkbox-label"
55 id="demo-multiple-checkbox"
56 multiple
57 value={category}
58 onChange={handleChange}
59 input={<OutlinedInput label="Category" />} // tuka odi soodvetno imeto na filter
60 renderValue={(selected) => selected.join(', ')}
61 MenuProps={MenuProps}
62>
63 {categories.map((cat) => (
64 <MenuItem key={cat} value={cat}>
65 <Checkbox checked={category.indexOf(cat) > -1} />
66 <ListItemText primary={cat} />
67 </MenuItem>
68 ))}
69 </Select>
70 </FormControl>
71 </div>
72 );
73}
Note: See TracBrowser for help on using the repository browser.