Skip to content

Instantly share code, notes, and snippets.

@NickToye
Created July 11, 2018 13:52
Show Gist options
  • Save NickToye/ed63428c7549254392cafc0078e17adf to your computer and use it in GitHub Desktop.
Save NickToye/ed63428c7549254392cafc0078e17adf to your computer and use it in GitHub Desktop.
import React from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import BottomNavigation from "@material-ui/core/BottomNavigation";
import BottomNavigationAction from "@material-ui/core/BottomNavigationAction";
import RestoreIcon from "@material-ui/icons/Restore";
import FavoriteIcon from "@material-ui/icons/Favorite";
import LocationOnIcon from "@material-ui/icons/LocationOn";
const styles = {
root: {
width: 500
}
};
class SimpleBottomNavigation extends React.Component {
state = {
value: 0
};
handleChange = (event, value) => {
this.setState({ value });
};
render() {
const { classes } = this.props;
const { value } = this.state;
return (
<BottomNavigation
value={value}
onChange={this.handleChange}
showLabels
className={classes.root}
>
<BottomNavigationAction label="Recents" icon={<RestoreIcon />} />
<BottomNavigationAction label="Favorites" icon={<FavoriteIcon />} />
<BottomNavigationAction label="Nearby" icon={<LocationOnIcon />} />
</BottomNavigation>
);
}
}
SimpleBottomNavigation.propTypes = {
classes: PropTypes.object.isRequired
};
export default withStyles(styles)(SimpleBottomNavigation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment