The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 lines
1.3 KiB

  1. import React from 'react';
  2. import { Sparklines, SparklinesCurve } from 'react-sparklines';
  3. import { Link } from 'react-router-dom';
  4. import { FormattedMessage } from 'react-intl';
  5. import ImmutablePropTypes from 'react-immutable-proptypes';
  6. import { shortNumberFormat } from '../utils/numbers';
  7. const Hashtag = ({ hashtag }) => (
  8. <div className='trends__item'>
  9. <div className='trends__item__name'>
  10. <Link to={`/timelines/tag/${hashtag.get('name')}`}>
  11. #<span>{hashtag.get('name')}</span>
  12. </Link>
  13. <FormattedMessage id='trends.count_by_accounts' defaultMessage='{count} {rawCount, plural, one {person} other {people}} talking' values={{ rawCount: hashtag.getIn(['history', 0, 'accounts']), count: <strong>{shortNumberFormat(hashtag.getIn(['history', 0, 'accounts']))}</strong> }} />
  14. </div>
  15. <div className='trends__item__current'>
  16. {shortNumberFormat(hashtag.getIn(['history', 0, 'uses']))}
  17. </div>
  18. <div className='trends__item__sparkline'>
  19. <Sparklines width={50} height={28} data={hashtag.get('history').reverse().map(day => day.get('uses')).toArray()}>
  20. <SparklinesCurve style={{ fill: 'none' }} />
  21. </Sparklines>
  22. </div>
  23. </div>
  24. );
  25. Hashtag.propTypes = {
  26. hashtag: ImmutablePropTypes.map.isRequired,
  27. };
  28. export default Hashtag;