From 73b090ab62a8a1b2ef57e090f7c7de882aad0a2e Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Wed, 16 Jun 2021 00:41:57 +0100 Subject: [PATCH] Update link component --- src/components/Link/index.tsx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/Link/index.tsx b/src/components/Link/index.tsx index 22f7fb2..6fdd3b3 100644 --- a/src/components/Link/index.tsx +++ b/src/components/Link/index.tsx @@ -2,7 +2,8 @@ import { Link as RouterLink } from 'react-router-dom'; import { Wrapper } from './styles'; type LinkProps = { - href: string; + href?: string; + url?: boolean; children?: React.ReactNode | JSX.Element | string; color?: | 'client' @@ -19,21 +20,31 @@ type LinkProps = { className?: string; iconLeft?: React.SVGProps; onClick?: () => void; + target?: '_self' | '_blank'; }; const Link = ({ href, + url = false, children, iconLeft, selected = false, + target = '_self', ...props }: LinkProps) => { return ( - - {iconLeft && {iconLeft}} - {children} - + {href && !url ? ( + + {iconLeft && {iconLeft}} + {children} + + ) : ( + + {iconLeft && {iconLeft}} + {children} + + )} ); };