import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import Icon from 'flavours/glitch/components/icon';
const ColumnLink = ({ icon, text, to, onClick, href, method, badge }) => {
  const badgeElement = typeof badge !== 'undefined' ? {badge} : null;
  if (href) {
    return (
      
        
        {text}
        {badgeElement}
      
    );
  } else if (to) {
    return (
      
        
        {text}
        {badgeElement}
      
    );
  } else {
    const handleOnClick = (e) => {
      e.preventDefault();
      e.stopPropagation();
      return onClick(e);
    }
    return (
      
        
        {text}
        {badgeElement}
      
    );
  }
};
ColumnLink.propTypes = {
  icon: PropTypes.string.isRequired,
  text: PropTypes.string.isRequired,
  to: PropTypes.string,
  onClick: PropTypes.func,
  href: PropTypes.string,
  method: PropTypes.string,
  badge: PropTypes.node,
};
export default ColumnLink;