(#1) Landing on Card component
This commit is contained in:
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user