diff options
Diffstat (limited to 'src/components/atoms/links/link.tsx')
| -rw-r--r-- | src/components/atoms/links/link.tsx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/components/atoms/links/link.tsx b/src/components/atoms/links/link.tsx index 674c07b..c8ba273 100644 --- a/src/components/atoms/links/link.tsx +++ b/src/components/atoms/links/link.tsx @@ -12,6 +12,10 @@ export type LinkProps = { */ className?: string; /** + * True if it is a download link. Default: false. + */ + download?: boolean; + /** * True if it is an external link. Default: false. */ external?: boolean; @@ -33,21 +37,29 @@ export type LinkProps = { const Link: FC<LinkProps> = ({ children, className = '', + download = false, + external = false, href, lang, - external = false, }) => { + const downloadClass = download ? styles['link--download'] : ''; + return external ? ( <a href={href} hrefLang={lang} - className={`${styles.link} ${styles['link--external']} ${className}`} + className={`${styles.link} ${styles['link--external']} ${downloadClass} ${className}`} > {children} </a> ) : ( <NextLink href={href}> - <a className={`${styles.link} ${className}`}>{children}</a> + <a + hrefLang={lang} + className={`${styles.link} ${downloadClass} ${className}`} + > + {children} + </a> </NextLink> ); }; |
