You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1011 B
40 lines
1011 B
8 years ago
|
import React from 'react';
|
||
8 years ago
|
import PropTypes from 'prop-types';
|
||
7 years ago
|
import { Link } from 'react-router-dom';
|
||
8 years ago
|
|
||
7 years ago
|
const ColumnLink = ({ icon, text, to, onClick, href, method }) => {
|
||
8 years ago
|
if (href) {
|
||
|
return (
|
||
7 years ago
|
<a href={href} className='column-link' data-method={method}>
|
||
8 years ago
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
||
8 years ago
|
{text}
|
||
|
</a>
|
||
|
);
|
||
7 years ago
|
} else if (to) {
|
||
8 years ago
|
return (
|
||
7 years ago
|
<Link to={to} className='column-link'>
|
||
8 years ago
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
||
8 years ago
|
{text}
|
||
|
</Link>
|
||
|
);
|
||
7 years ago
|
} else {
|
||
|
return (
|
||
7 years ago
|
<a onClick={onClick} className='column-link' role='button' tabIndex='0' data-method={method}>
|
||
7 years ago
|
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
|
||
|
{text}
|
||
|
</a>
|
||
|
);
|
||
8 years ago
|
}
|
||
|
};
|
||
|
|
||
|
ColumnLink.propTypes = {
|
||
8 years ago
|
icon: PropTypes.string.isRequired,
|
||
|
text: PropTypes.string.isRequired,
|
||
|
to: PropTypes.string,
|
||
7 years ago
|
onClick: PropTypes.func,
|
||
8 years ago
|
href: PropTypes.string,
|
||
|
method: PropTypes.string,
|
||
8 years ago
|
};
|
||
|
|
||
|
export default ColumnLink;
|