gab-social/app/javascript/gabsocial/components/trending_item.js

56 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-02-08 06:12:01 +00:00
import { FormattedMessage } from 'react-intl'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { NavLink } from 'react-router-dom'
import classNames from 'classnames/bind'
import { shortNumberFormat } from '../utils/numbers'
2020-02-19 23:57:07 +00:00
const cx = classNames.bind(_s)
2020-02-08 06:12:01 +00:00
export default class TrendingItem extends ImmutablePureComponent {
static propTypes = {
2020-02-19 23:57:07 +00:00
trend: ImmutablePropTypes.map.isRequired,
2020-02-08 06:12:01 +00:00
};
state = {
hovering: false,
}
handleOnMouseEnter = () => {
this.setState({ hovering: true })
}
handleOnMouseLeave = () => {
this.setState({ hovering: false })
}
render() {
2020-02-19 23:57:07 +00:00
const { trend } = this.props
2020-02-08 06:12:01 +00:00
const { hovering } = this.state
const subtitleClasses = cx({
default: 1,
text: 1,
displayFlex: 1,
fontSize13PX: 1,
fontWeightNormal: 1,
2020-02-19 23:57:07 +00:00
colorSecondary: 1,
2020-02-08 06:12:01 +00:00
underline: hovering,
})
return (
<NavLink
to='/test'
2020-02-19 23:57:07 +00:00
className={[_s.default, _s.noUnderline, _s.marginBottom10PX].join(' ')}
2020-02-08 06:12:01 +00:00
onMouseEnter={() => this.handleOnMouseEnter()}
onMouseLeave={() => this.handleOnMouseLeave()}
>
2020-02-19 23:57:07 +00:00
<span className={[_s.default, _s.text, _s.displayFlex, _s.colorBrand, _s.fontSize15PX, _s.fontWeightBold, _s.lineHeight15].join(' ')}>#randomhashtag</span>
2020-02-08 06:12:01 +00:00
<span className={subtitleClasses}>10,240 Gabs</span>
</NavLink>
)
}
}