(#1) Добил вёрстку центральных блоков landing

This commit is contained in:
2024-04-20 22:33:06 +03:00
parent 68e94680e3
commit 79bed2dae6
7 changed files with 146 additions and 48 deletions
+14 -2
View File
@@ -4,7 +4,14 @@ import { externalIcon } from '../../assets/icons'
import { StyledLink } from './link.styled'
export const Link = (props) => {
interface LinkProps {
href: string;
children: React.ReactNode;
contrast?: boolean;
inheritColor?: boolean;
}
export const Link = (props: LinkProps) => {
const isExternal = useMemo(() => props.href?.startsWith('http'), [props.href]);
const linkProps: any = {}
@@ -15,9 +22,14 @@ export const Link = (props) => {
}
return (
<StyledLink contrast={props.contrast} href={props.href} {...linkProps}>
<StyledLink inheritColor={props.inheritColor} contrast={props.contrast} href={props.href} {...linkProps}>
{props.children}
{isExternal && <img src={externalIcon} alt="external link icon" />}
</StyledLink>
);
};
Link.defaultProps = {
contrast: false,
inheritColor: false,
}