{"size": 810, "ext": "js", "max_stars_repo_path": "src/Tag.js", "max_stars_repo_name": "Track-your-parliament/track-your-parliament-frontend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Tag.js", "max_issues_repo_name": "Track-your-parliament/track-your-parliament-frontend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Tag.js", "max_forks_repo_name": "Track-your-parliament/track-your-parliament-frontend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.1290322581, "max_line_length": 77, "alphanum_fraction": 0.6197530864}
import React from 'react'
import { Chip, makeStyles } from '@material-ui/core'
import { useHistory } from 'react-router-dom'

const useStyles = makeStyles(theme => ({
  chip: props => ({
    margin: theme.spacing(1),
    fontSize: props.size * 0.05 + 1 + 'rem',
    height: props.size * 0.1 + 1.2 + 'rem',
    borderRadius: props.size * 0.05 + 1 + 'rem',
    paddingLeft: props.size * 0.01 + 'rem',
    paddingRight: props.size * 0.01 + 'rem',
  }),
}))

const Tag = ({ text, size }) => {
  const classes = useStyles({ size })
  const history = useHistory()

  const handleClick = e => {
    history.push('/proposal?search=' + text)
    window.scrollTo({ top: 0, behavior: 'smooth' })
  }

  return <Chip label={text} className={classes.chip} onClick={handleClick} />
}

Tag.propTypes = {}

export default Tag
