import React from 'react'; import { PropTypes } from 'prop-types'; import { Helmet } from 'react-helmet'; import brand from 'ba-api/brand'; import SearchIcon from '@material-ui/icons/Search'; import SettingsIcon from '@material-ui/icons/SettingsApplications'; import { withStyles } from '@material-ui/core/styles'; import settingList from 'ba-api/settingList'; import { AppBar, Grid, Toolbar, Typography, Button, Icon } from '@material-ui/core'; import DetailSettings from './DetailSettings'; import styles from './settings-jss'; class Settings extends React.Component { state = { open: false, checked: ['switch', 'check2'], keyword: '' }; handleToggle = value => () => { const { checked } = this.state; const currentIndex = checked.indexOf(value); const newChecked = [...checked]; if (currentIndex === -1) { newChecked.push(value); } else { newChecked.splice(currentIndex, 1); } this.setState({ checked: newChecked, }); }; handleChange = name => event => { this.setState({ [name]: event.target.value, }); }; handleClickOpen = () => { this.setState({ open: true }); }; handleClose = () => { this.setState({ open: false }); }; handleSearch = event => { this.setState({ keyword: event.target.value.toLowerCase() }); } render() { const title = brand.name; const description = brand.desc; const { classes } = this.props; const { keyword } = this.state; return (
{title} Appication Settings
this.handleSearch(event)} />
{settingList.map(menu => { const rawKey = menu.name + menu.caption; if (rawKey.toLowerCase().indexOf(keyword) === -1) { return false; } return ( ); })}
); } } Settings.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(Settings);