闭社主体 forked from https://github.com/tootsuite/mastodon
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.

41 lines
925 B

  1. import { Link } from 'react-router';
  2. const outerStyle = {
  3. display: 'block',
  4. padding: '15px',
  5. fontSize: '16px',
  6. textDecoration: 'none'
  7. };
  8. const iconStyle = {
  9. display: 'inline-block',
  10. marginRight: '5px'
  11. };
  12. const ColumnLink = ({ icon, text, to, href, method }) => {
  13. if (href) {
  14. return (
  15. <a href={href} style={outerStyle} className='column-link' data-method={method}>
  16. <i className={`fa fa-fw fa-${icon}`} style={iconStyle} />
  17. {text}
  18. </a>
  19. );
  20. } else {
  21. return (
  22. <Link to={to} style={outerStyle} className='column-link'>
  23. <i className={`fa fa-fw fa-${icon}`} style={iconStyle} />
  24. {text}
  25. </Link>
  26. );
  27. }
  28. };
  29. ColumnLink.propTypes = {
  30. icon: React.PropTypes.string.isRequired,
  31. text: React.PropTypes.string.isRequired,
  32. to: React.PropTypes.string,
  33. href: React.PropTypes.string,
  34. method: React.PropTypes.string
  35. };
  36. export default ColumnLink;