diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-03 08:56:49 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-03 08:56:49 +0800 |
commit | edb3a613879ecb4ae077dc4e4256965de2092e48 (patch) | |
tree | b7860f548c5399238d466f51241d86720b3a87a2 /packages/website/ts/components/link.tsx | |
parent | 89f67b9becf3b4c0d13cceeaca4d5656ad500a9a (diff) | |
parent | 1ddf1087dd327b2ef35165518ee91eb457b84174 (diff) | |
download | dexon-sol-tools-edb3a613879ecb4ae077dc4e4256965de2092e48.tar dexon-sol-tools-edb3a613879ecb4ae077dc4e4256965de2092e48.tar.gz dexon-sol-tools-edb3a613879ecb4ae077dc4e4256965de2092e48.tar.bz2 dexon-sol-tools-edb3a613879ecb4ae077dc4e4256965de2092e48.tar.lz dexon-sol-tools-edb3a613879ecb4ae077dc4e4256965de2092e48.tar.xz dexon-sol-tools-edb3a613879ecb4ae077dc4e4256965de2092e48.tar.zst dexon-sol-tools-edb3a613879ecb4ae077dc4e4256965de2092e48.zip |
Merge branch 'development' into feature/instant/tell-amount-available
Diffstat (limited to 'packages/website/ts/components/link.tsx')
-rw-r--r-- | packages/website/ts/components/link.tsx | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/packages/website/ts/components/link.tsx b/packages/website/ts/components/link.tsx new file mode 100644 index 000000000..080a0abcc --- /dev/null +++ b/packages/website/ts/components/link.tsx @@ -0,0 +1,64 @@ +import { Link as SmartLink } from '@0x/react-shared'; +import * as React from 'react'; +import styled from 'styled-components'; + +interface LinkInterface { + color?: string; + children?: React.ReactNode | string; + isNoArrow?: boolean; + hasIcon?: boolean | string; + isBlock?: boolean; + isCentered?: boolean; + href?: string; + theme?: { + textColor: string; + }; + shouldOpenInNewTab?: boolean; + target?: string; +} + +export const Link = (props: LinkInterface) => { + const { children, isNoArrow, href } = props; + + return ( + <StyledLink to={href} {...props}> + {children} + {!isNoArrow && ( + <svg width="25" height="25" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path + d="M8.484 5.246l.023 1.411 8.147.053L4.817 18.547l.996.996L17.65 7.706l.052 8.146 1.411.024-.068-10.561-10.561-.069z" + fill="currentColor" + /> + </svg> + )} + </StyledLink> + ); +}; + +// Added this, & + & doesnt really work since we switch with element types... +export const LinkWrap = styled.div` + a + a, + a + button, + button + a { + margin-left: 20px; + } +`; + +const StyledLink = + styled(SmartLink) < + LinkInterface > + ` + display: ${props => !props.isBlock && 'inline-flex'}; + color: ${props => props.color || props.theme.linkColor}; + text-align: center; + font-size: 18px; + text-decoration: none; + align-items: center; + + @media (max-width: 768px) { + } + + svg { + margin-left: 3px; + } +`; |