2020-08-04 08:20:35 +02:00
|
|
|
import React from 'react';
|
2021-02-16 13:10:34 +01:00
|
|
|
import PropTypes from 'prop-types';
|
2020-08-04 08:20:35 +02:00
|
|
|
import classNames from 'classnames';
|
|
|
|
import NextLink from 'next/link';
|
2020-09-26 08:38:28 +02:00
|
|
|
import Icon from './Icon';
|
2020-08-04 08:20:35 +02:00
|
|
|
import styles from './Link.module.css';
|
|
|
|
|
2022-03-01 03:39:37 +01:00
|
|
|
function Link({ className, icon, children, size, iconRight, onClick, ...props }) {
|
2020-08-04 08:20:35 +02:00
|
|
|
return (
|
2020-08-05 07:45:05 +02:00
|
|
|
<NextLink {...props}>
|
2020-09-26 08:38:28 +02:00
|
|
|
<a
|
|
|
|
className={classNames(styles.link, className, {
|
|
|
|
[styles.large]: size === 'large',
|
|
|
|
[styles.small]: size === 'small',
|
|
|
|
[styles.xsmall]: size === 'xsmall',
|
|
|
|
[styles.iconRight]: iconRight,
|
|
|
|
})}
|
2022-03-01 03:39:37 +01:00
|
|
|
onClick={onClick}
|
2020-09-26 08:38:28 +02:00
|
|
|
>
|
|
|
|
{icon && <Icon className={styles.icon} icon={icon} size={size} />}
|
|
|
|
{children}
|
|
|
|
</a>
|
2020-08-04 08:20:35 +02:00
|
|
|
</NextLink>
|
|
|
|
);
|
|
|
|
}
|
2021-02-16 13:10:34 +01:00
|
|
|
|
|
|
|
Link.propTypes = {
|
|
|
|
className: PropTypes.string,
|
|
|
|
icon: PropTypes.node,
|
|
|
|
children: PropTypes.node,
|
|
|
|
size: PropTypes.oneOf(['large', 'small', 'xsmall']),
|
|
|
|
iconRight: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Link;
|