2017-05-03 02:04:16 +02:00
|
|
|
import React from 'react';
|
2017-04-21 20:05:35 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2017-06-20 20:40:03 +02:00
|
|
|
import Link from 'react-router-dom/Link';
|
2016-12-12 14:27:52 +01:00
|
|
|
|
2017-06-29 07:00:54 +02:00
|
|
|
const ColumnLink = ({ icon, text, to, onClick, href, method, hideOnMobile }) => {
|
2016-12-12 14:27:52 +01:00
|
|
|
if (href) {
|
|
|
|
return (
|
2017-04-23 05:21:38 +02:00
|
|
|
<a href={href} className={`column-link ${hideOnMobile ? 'hidden-on-mobile' : ''}`} data-method={method}>
|
2017-04-23 04:26:55 +02:00
|
|
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
2016-12-12 14:27:52 +01:00
|
|
|
{text}
|
|
|
|
</a>
|
|
|
|
);
|
2017-06-29 07:00:54 +02:00
|
|
|
} else if (to) {
|
2016-12-12 14:27:52 +01:00
|
|
|
return (
|
2017-04-23 04:26:55 +02:00
|
|
|
<Link to={to} className={`column-link ${hideOnMobile ? 'hidden-on-mobile' : ''}`}>
|
|
|
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
2016-12-12 14:27:52 +01:00
|
|
|
{text}
|
|
|
|
</Link>
|
|
|
|
);
|
2017-06-29 07:00:54 +02:00
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<a onClick={onClick} role='button' tabIndex='0' className={`column-link ${hideOnMobile ? 'hidden-on-mobile' : ''}`} data-method={method}>
|
|
|
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
|
|
|
{text}
|
|
|
|
</a>
|
|
|
|
);
|
2016-12-12 14:27:52 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ColumnLink.propTypes = {
|
2017-04-21 20:05:35 +02:00
|
|
|
icon: PropTypes.string.isRequired,
|
|
|
|
text: PropTypes.string.isRequired,
|
|
|
|
to: PropTypes.string,
|
2017-06-29 07:00:54 +02:00
|
|
|
onClick: PropTypes.func,
|
2017-04-21 20:05:35 +02:00
|
|
|
href: PropTypes.string,
|
|
|
|
method: PropTypes.string,
|
2017-05-20 17:31:47 +02:00
|
|
|
hideOnMobile: PropTypes.bool,
|
2016-12-12 14:27:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ColumnLink;
|