import classNames from 'classnames'; import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage, defineMessages } from 'react-intl'; import Hashtag from '../../../components/hashtag'; import { Link } from 'react-router-dom'; const messages = defineMessages({ refresh_trends: { id: 'trends.refresh', defaultMessage: 'Refresh' }, }); export default class Trends extends ImmutablePureComponent { static defaultProps = { loading: false, }; static propTypes = { trends: ImmutablePropTypes.list, loading: PropTypes.bool.isRequired, showTrends: PropTypes.bool.isRequired, fetchTrends: PropTypes.func.isRequired, toggleTrends: PropTypes.func.isRequired, }; componentDidMount () { setTimeout(() => this.props.fetchTrends(), 5000); } handleRefreshTrends = () => { this.props.fetchTrends(); } handleToggle = () => { this.props.toggleTrends(!this.props.showTrends); } render () { const { intl, trends, loading, showTrends } = this.props; if (!trends || trends.size < 1) { return null; } return (

{showTrends && }

{showTrends &&
{trends.take(3).map(hashtag => )}
}
); } }