You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.9 KiB
74 lines
1.9 KiB
import React from "react"; |
|
import { makeStyles, withStyles } from "@material-ui/core/styles"; |
|
import FormControl from "@material-ui/core/FormControl"; |
|
import NativeSelect from "@material-ui/core/NativeSelect"; |
|
import InputBase from "@material-ui/core/InputBase"; |
|
|
|
const BootstrapInput = withStyles((theme) => ({ |
|
root: { |
|
"label + &": { |
|
marginTop: theme.spacing(3), |
|
}, |
|
}, |
|
input: { |
|
borderRadius: 4, |
|
position: "relative", |
|
backgroundColor: theme.palette.background.paper, |
|
border: "1px solid #ced4da", |
|
fontSize: 16, |
|
padding: "10px 26px 10px 12px", |
|
transition: theme.transitions.create(["border-color", "box-shadow"]), |
|
// Use the system font instead of the default Roboto font. |
|
fontFamily: [ |
|
"-apple-system", |
|
"BlinkMacSystemFont", |
|
'"Segoe UI"', |
|
"Roboto", |
|
'"Helvetica Neue"', |
|
"Arial", |
|
"sans-serif", |
|
'"Apple Color Emoji"', |
|
'"Segoe UI Emoji"', |
|
'"Segoe UI Symbol"', |
|
].join(","), |
|
"&:focus": { |
|
borderRadius: 4, |
|
}, |
|
}, |
|
}))(InputBase); |
|
|
|
const useStyles = makeStyles((theme) => ({ |
|
margin: { |
|
margin: theme.spacing(1), |
|
}, |
|
})); |
|
|
|
export default function CustomizedSelects(props) { |
|
const classes = useStyles(); |
|
const { name, parent } = props; |
|
return ( |
|
<div className="home-search__select mr-2"> |
|
<FormControl className={classes.margin}> |
|
<NativeSelect |
|
id="demo-customized-select-native" |
|
onChange={(e) => |
|
parent.setState({ |
|
filters: { |
|
...parent.state.filters, |
|
[name]: |
|
e.target.value === window.t(window.t("پایه تحصیلی")) ? [] : [e.target.value], |
|
}, |
|
}) |
|
} |
|
input={<BootstrapInput />} |
|
> |
|
{props.options.map((item, i) => ( |
|
<option value={item} key={i}> |
|
{item} |
|
</option> |
|
))} |
|
</NativeSelect> |
|
</FormControl> |
|
</div> |
|
); |
|
}
|
|
|