blob: 3e784406f8cec68a56d785ec16d63c282aff97b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import { ButtonPosition } from '@ts/types/app';
import Link from 'next/link';
import { ReactNode } from 'react';
import styles from '../Buttons.module.scss';
const ButtonLink = ({
children,
target,
position = 'left',
isExternal = false,
hasIcon = false,
}: {
children: ReactNode;
target: string;
position?: ButtonPosition;
isExternal?: boolean;
hasIcon?: boolean;
}) => {
const positionModifier = `link--${position}`;
const iconModifier = hasIcon ? ` ${styles['link--icon']}` : '';
const classes = `${styles.btn} ${styles.link} ${styles[positionModifier]}${iconModifier}`;
return isExternal ? (
<a className={classes} href={target}>
{children}
</a>
) : (
<Link href={target}>
<a className={classes}>{children}</a>
</Link>
);
};
export default ButtonLink;
|