Skip to content

Instantly share code, notes, and snippets.

@leihuagh
Created April 20, 2018 18:45
Show Gist options
  • Select an option

  • Save leihuagh/acff46641ca4fd3ab9088d42d4a81702 to your computer and use it in GitHub Desktop.

Select an option

Save leihuagh/acff46641ca4fd3ab9088d42d4a81702 to your computer and use it in GitHub Desktop.
leftpane.js
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