logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

column_link.js (937B)


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