Last active
February 21, 2020 17:27
-
-
Save r3dm1ke/44ec556825bb915666c536a3963513c2 to your computer and use it in GitHub Desktop.
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 from 'react'; | |
| import { | |
| ExpansionPanel, | |
| ExpansionPanelSummary, | |
| ExpansionPanelDetails, | |
| Typography, | |
| Chip, | |
| makeStyles | |
| } from "@material-ui/core"; | |
| import StarIcon from '@material-ui/icons/Star'; | |
| import PeopleIcon from '@material-ui/icons/People'; | |
| const useStyles = makeStyles({ | |
| root: { | |
| marginTop: '1rem' | |
| }, | |
| summaryContainer: { | |
| flexDirection: 'column', | |
| }, | |
| summaryHeader: { | |
| display: 'flex', | |
| flexDirection: 'row', | |
| justifyContent: 'space-between', | |
| marginBottom: '1rem' | |
| }, | |
| chip: { | |
| marginLeft: '0.5rem' | |
| } | |
| }); | |
| const Repository = ({repo, expanded, onToggled}) => { | |
| const {node: {name, descriptionHTML, owner: {login}, stargazers: {totalCount: totalStarCount}}} = repo; | |
| const classes = useStyles(); | |
| return ( | |
| <ExpansionPanel | |
| expanded={expanded} | |
| onChange={onToggled} | |
| className={classes.root} | |
| > | |
| <ExpansionPanelSummary classes={{content: classes.summaryContainer}}> | |
| <div className={classes.summaryHeader}> | |
| <Typography variant={'h6'}>{name}</Typography> | |
| <div> | |
| <Chip label={`by ${login}`} avatar={<PeopleIcon/>} className={classes.chip}/> | |
| <Chip label={totalStarCount} avatar={<StarIcon/>} className={classes.chip}/> | |
| </div> | |
| </div> | |
| <Typography | |
| variant={'caption'} | |
| dangerouslySetInnerHTML={{__html: descriptionHTML}} | |
| component={'div'} | |
| /> | |
| </ExpansionPanelSummary> | |
| <ExpansionPanelDetails> | |
| Issues here! | |
| </ExpansionPanelDetails> | |
| </ExpansionPanel> | |
| ); | |
| }; | |
| export default Repository; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment