2020-02-19 23:57:07 +00:00
|
|
|
import { NavLink } from 'react-router-dom'
|
|
|
|
import Text from './text'
|
|
|
|
|
|
|
|
export default class UserStat extends PureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
to: PropTypes.string,
|
|
|
|
title: PropTypes.string,
|
|
|
|
value: PropTypes.string,
|
|
|
|
}
|
|
|
|
|
|
|
|
state = {
|
|
|
|
hovering: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
handleOnMouseEnter = () => {
|
|
|
|
this.setState({ hovering: true })
|
|
|
|
}
|
|
|
|
|
|
|
|
handleOnMouseLeave = () => {
|
|
|
|
this.setState({ hovering: false })
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { to, title, value } = this.props
|
|
|
|
const { hovering } = this.state
|
|
|
|
|
|
|
|
return (
|
|
|
|
<NavLink
|
|
|
|
to={to}
|
|
|
|
title={`${value} ${title}`}
|
2020-03-11 23:56:18 +00:00
|
|
|
className={[_s.default, _s.flexGrow1, _s.cursorPointer, _s.noUnderline, _s.pr15].join(' ')}
|
2020-02-19 23:57:07 +00:00
|
|
|
onMouseEnter={() => this.handleOnMouseEnter()}
|
|
|
|
onMouseLeave={() => this.handleOnMouseLeave()}
|
|
|
|
>
|
|
|
|
<Text size='large' weight='bold' color='brand'>
|
|
|
|
{value}
|
|
|
|
</Text>
|
|
|
|
<Text size='small' weight='medium' color='secondary' underline={hovering}>
|
|
|
|
{title}
|
|
|
|
</Text>
|
|
|
|
</NavLink>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|