Подготовка компонента на лэндинг
This commit is contained in:
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user