2017-05-02 17:04:16 -07:00
|
|
|
import React from 'react';
|
2017-04-21 11:05:35 -07:00
|
|
|
import PropTypes from 'prop-types';
|
2017-10-07 17:55:58 -07:00
|
|
|
import { Link } from 'react-router-dom';
|
2016-12-12 05:27:52 -08:00
|
|
|
|
2017-08-01 13:07:43 -07:00
|
|
|
const ColumnLink = ({ icon, text, to, onClick, href, method }) => {
|
2016-12-12 05:27:52 -08:00
|
|
|
if (href) {
|
|
|
|
return (
|
2017-07-26 04:46:53 -07:00
|
|
|
<a href={href} className='column-link' data-method={method}>
|
2017-04-22 19:26:55 -07:00
|
|
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
2016-12-12 05:27:52 -08:00
|
|
|
{text}
|
|
|
|
</a>
|
|
|
|
);
|
2017-06-28 22:00:54 -07:00
|
|
|
} else if (to) {
|
2016-12-12 05:27:52 -08:00
|
|
|
return (
|
2017-07-26 04:46:53 -07:00
|
|
|
<Link to={to} className='column-link'>
|
2017-04-22 19:26:55 -07:00
|
|
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
2016-12-12 05:27:52 -08:00
|
|
|
{text}
|
|
|
|
</Link>
|
|
|
|
);
|
2017-06-28 22:00:54 -07:00
|
|
|
} else {
|
|
|
|
return (
|
2017-08-01 13:46:52 -07:00
|
|
|
<a onClick={onClick} className='column-link' role='button' tabIndex='0' data-method={method}>
|
2017-06-28 22:00:54 -07:00
|
|
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
|
|
|
{text}
|
|
|
|
</a>
|
|
|
|
);
|
2016-12-12 05:27:52 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ColumnLink.propTypes = {
|
2017-04-21 11:05:35 -07:00
|
|
|
icon: PropTypes.string.isRequired,
|
|
|
|
text: PropTypes.string.isRequired,
|
|
|
|
to: PropTypes.string,
|
2017-06-28 22:00:54 -07:00
|
|
|
onClick: PropTypes.func,
|
2017-04-21 11:05:35 -07:00
|
|
|
href: PropTypes.string,
|
|
|
|
method: PropTypes.string,
|
2016-12-12 05:27:52 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ColumnLink;
|