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

67 lines
1.7 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-21 00:57:29 +00:00
import Text from './text'
import Button from './button'
import Image from './image'
2020-02-08 06:12:01 +00:00
2020-02-19 23:57:07 +00:00
const cx = classNames.bind(_s)
2020-02-21 00:57:29 +00:00
export default class TrendingItemCard extends ImmutablePureComponent {
2020-02-08 06:12:01 +00:00
static propTypes = {
2020-02-19 23:57:07 +00:00
trend: ImmutablePropTypes.map.isRequired,
2020-02-29 15:42:47 +00:00
}
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,
})
2020-02-21 00:57:29 +00:00
// URL with title, description
// URL with video
// URL with title, description, image
2020-02-08 06:12:01 +00:00
return (
2020-02-21 00:57:29 +00:00
<div className={[_s.default, _s.flexRow, _s.overflowHidden, _s.borderColorSecondary, _s.border1PX, _s.radiusSmall, _s.backgroundSubtle_onHover].join(' ')}>
<div className={[_s.default, _s.flexNormal, _s.paddingVertical10PX, _s.paddingHorizontal10PX].join(' ')}>
<Text color='secondary' className={_s.lineHeight15}>
NYPost
</Text>
<Text size='medium' color='primary'>
The best flower subscription services: BloomsyBox, Bouqs...
</Text>
</div>
<Image width='92px' height='92px' />
</div>
2020-02-08 06:12:01 +00:00
)
}
}