Подготовка компонента на лэндинг

This commit is contained in:
2024-04-20 13:23:27 +03:00
parent d79676cbb4
commit 388aec2050
11 changed files with 73 additions and 15 deletions

View File

@@ -1,13 +1,19 @@
import React from "react";
import React, { useMemo } from "react";
import { externalIcon } from '../../assets/icons'
// import './style.css'
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]);
return (
<StyledLink contrast={props.contrast} href={props.href}>
{props.children}
{isExternal && <img src={externalIcon} alt="external" />}
</StyledLink>
);
};