Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 12x 12x 12x | import React from 'react'; import PropTypes from 'prop-types'; import * as R from 'ramda'; import Grid from '@material-ui/core/Grid'; import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; const useStyles = makeStyles(theme => ({ paperItem: { padding: theme.spacing(1.25), '&:hover': { cursor: 'pointer', backgroundColor: R.path(['palette', 'tertiary', 'light'])(theme) || theme.palette.secondary.light, }, }, itemTitle: { color: theme.palette.primary.main, fontSize: '0.875rem', }, itemSubtitle: { color: theme.palette.grey[600], fontSize: '0.75rem', }, })); const Item = ({ parentId, item, action }) => { const classes = useStyles(); return ( <Grid item md={4} xs={12} className={classes.paperItem} onClick={R.is(Function) ? () => action(parentId, R.prop('id')(item)) : null} > <Typography variant="h5" className={classes.itemTitle}> {R.prop('label')(item)} </Typography> <Typography variant="subtitle1" className={classes.itemSubtitle}> {R.pipe(R.propOr([], 'subtopics'), R.intersperse(', '))(item)} </Typography> </Grid> ); }; Item.propTypes = { parentId: PropTypes.string, item: PropTypes.object, action: PropTypes.func, }; export default Item; |