joywok-material-components
Version:
<h1 align="center"> Joywok Material Components </h1>
48 lines (46 loc) • 1.25 kB
JavaScript
// Select.js
import React from 'react';
import { withStyles } from '@material-ui/core/styles';
import { makeStyles } from '@material-ui/core/styles';
import Select from '@material-ui/core/Select';
import MenuItem from '@material-ui/core/MenuItem';
const styles = {
container: {
display: 'flex'
}
};
const MenuProps = {
PaperProps: {
style: {
background:"#fff"
},
},
};
class CustomSelect extends React.Component {
constructor(props) {
super(props);
}
render() {
console.log('customeMenu:',this.props);
let self = this;
const { classes,options} = this.props;
const selectClassName = classes.input+' jw-custom-select ' + (this.props.className || '')
return (
<div className={'jw-custom-select-w'}>
<Select {...this.props} className={selectClassName} MenuProps={MenuProps}>
{
options.map(i => (
<MenuItem key={i.key} value={i.key} className={this.props.checkIcon?'has-check-icon':""}>
{self.props.key == i['key']?this.props.checkIcon:''}
{i.value}
</MenuItem>
))
}
</Select>
</div>
);
}
componentDidMount(){
}
}
export default withStyles(styles)(CustomSelect);