闭社主体 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.

32 lines
873 B

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { Link } from 'react-router';
  4. const ColumnLink = ({ icon, text, to, href, method, hideOnMobile }) => {
  5. if (href) {
  6. return (
  7. <a href={href} className={`column-link ${hideOnMobile ? 'hidden-on-mobile' : ''}`} data-method={method}>
  8. <i className={`fa fa-fw fa-${icon} column-link__icon`} />
  9. {text}
  10. </a>
  11. );
  12. } else {
  13. return (
  14. <Link to={to} className={`column-link ${hideOnMobile ? 'hidden-on-mobile' : ''}`}>
  15. <i className={`fa fa-fw fa-${icon} column-link__icon`} />
  16. {text}
  17. </Link>
  18. );
  19. }
  20. };
  21. ColumnLink.propTypes = {
  22. icon: PropTypes.string.isRequired,
  23. text: PropTypes.string.isRequired,
  24. to: PropTypes.string,
  25. href: PropTypes.string,
  26. method: PropTypes.string,
  27. hideOnMobile: PropTypes.bool
  28. };
  29. export default ColumnLink;