Created
April 20, 2018 18:45
-
-
Save leihuagh/acff46641ca4fd3ab9088d42d4a81702 to your computer and use it in GitHub Desktop.
leftpane.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component, Fragment } from 'react' | |
| import { | |
| Grid, | |
| Paper, | |
| Typography, | |
| List, | |
| ListItem, | |
| ListItemText | |
| } from 'material-ui' | |
| class LeftPane extends Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| styles: this.props.styles, | |
| exercises: this.props.exercises | |
| } | |
| } | |
| render() { | |
| const { styles, exercises } = this.state | |
| return ( | |
| <Grid item sm> | |
| <Paper style={styles.Paper}> | |
| {exercises.map(([group, exercises]) => ( | |
| <Fragment key={group}> | |
| <Typography | |
| variant="headline" | |
| style={{ textTransform: 'capitalize' }} | |
| > | |
| {group} | |
| </Typography> | |
| <List component="ul"> | |
| {exercises.map(({ id, title }) => ( | |
| <ListItem button key={id}> | |
| <ListItemText primary={title} /> | |
| </ListItem> | |
| ))} | |
| </List> | |
| </Fragment> | |
| ))} | |
| </Paper> | |
| </Grid> | |
| ) | |
| } | |
| } | |
| export default LeftPane |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment