(#1) Landing on Card component

This commit is contained in:
2024-04-20 15:14:49 +03:00
parent 388aec2050
commit 68e94680e3
7 changed files with 80 additions and 59 deletions

View File

@@ -3,17 +3,21 @@ import React, { useMemo } from "react";
import { externalIcon } from '../../assets/icons'
import { StyledLink } from './link.styled'
// import './style.css'
export const Link = (props) => {
// const className = 'link' + (props.contrast ? ' link__contrast' : '')
const isExternal = useMemo(() => props.href.startsWith('http'), [props.href]);
const isExternal = useMemo(() => props.href?.startsWith('http'), [props.href]);
const linkProps: any = {}
if (isExternal) {
linkProps.target = '_blank'
linkProps.rel = 'noopener noreferrer'
}
return (
<StyledLink contrast={props.contrast} href={props.href}>
<StyledLink contrast={props.contrast} href={props.href} {...linkProps}>
{props.children}
{isExternal && <img src={externalIcon} alt="external" />}
{isExternal && <img src={externalIcon} alt="external link icon" />}
</StyledLink>
);
};

View File

@@ -1,10 +0,0 @@
.link {
font-weight: 400;
text-decoration: underline;
text-decoration-skip-ink: none;
color: var(--dark-link);
}
.link__contrast {
color: var(--text-contrast);
}