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