(#1) Добил вёрстку центральных блоков landing
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user