diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2019-01-02 22:13:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-02 22:13:14 +0800 |
commit | 1ddf1087dd327b2ef35165518ee91eb457b84174 (patch) | |
tree | 619d5b8afd97945eb7917cb71b74ed1c721a77d3 /packages/website/ts/components/blockIconLink.tsx | |
parent | dbbd0c5c9233965713a3ee30a1a0c5eb06448212 (diff) | |
parent | dc6d6024dc7e72d2634c6bbd88886af6cc0ef6fc (diff) | |
download | dexon-sol-tools-1ddf1087dd327b2ef35165518ee91eb457b84174.tar dexon-sol-tools-1ddf1087dd327b2ef35165518ee91eb457b84174.tar.gz dexon-sol-tools-1ddf1087dd327b2ef35165518ee91eb457b84174.tar.bz2 dexon-sol-tools-1ddf1087dd327b2ef35165518ee91eb457b84174.tar.lz dexon-sol-tools-1ddf1087dd327b2ef35165518ee91eb457b84174.tar.xz dexon-sol-tools-1ddf1087dd327b2ef35165518ee91eb457b84174.tar.zst dexon-sol-tools-1ddf1087dd327b2ef35165518ee91eb457b84174.zip |
Merge pull request #1470 from 0xProject/feature/website/0x-org-cleanup
[website] Remove @next dir, remove unused files.
Diffstat (limited to 'packages/website/ts/components/blockIconLink.tsx')
-rw-r--r-- | packages/website/ts/components/blockIconLink.tsx | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/packages/website/ts/components/blockIconLink.tsx b/packages/website/ts/components/blockIconLink.tsx new file mode 100644 index 000000000..ff7712595 --- /dev/null +++ b/packages/website/ts/components/blockIconLink.tsx @@ -0,0 +1,84 @@ +import { History, Location } from 'history'; +import * as React from 'react'; +import { match, withRouter } from 'react-router-dom'; +import styled from 'styled-components'; + +import { Button } from 'ts/components/button'; +import { Icon } from 'ts/components/icon'; + +interface BaseComponentProps { + icon?: string; + iconComponent?: React.ReactNode; + title: string; + linkLabel: string; + linkUrl?: string; + linkAction?: () => void; + history: History; + location: Location; + match: match<any>; +} + +class BaseComponent extends React.PureComponent<BaseComponentProps> { + public onClick = (): void => { + const { linkAction, linkUrl } = this.props; + + if (linkAction) { + linkAction(); + } else { + this.props.history.push(linkUrl); + } + }; + + public render(): React.ReactNode { + const { icon, iconComponent, linkUrl, linkAction, title, linkLabel } = this.props; + + return ( + <Wrap onClick={this.onClick}> + <div> + <Icon name={icon} component={iconComponent} size="large" margin={[0, 0, 'default', 0]} /> + + <Title>{title}</Title> + + <Button isWithArrow={true} isTransparent={true} href={linkUrl} onClick={linkAction}> + {linkLabel} + </Button> + </div> + </Wrap> + ); + } +} + +export const BlockIconLink = withRouter<BaseComponentProps>(BaseComponent); + +const Wrap = styled.div` + width: calc(50% - 15px); + height: 400px; + padding: 40px; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + transition: background-color 0.25s; + background-color: ${props => props.theme.lightBgColor}; + cursor: pointer; + + a, + button { + pointer-events: none; + } + + @media (max-width: 900px) { + width: 100%; + margin-top: 30px; + } + + &:hover { + background-color: #002d28; + } +`; + +const Title = styled.h2` + font-size: 20px; + margin-bottom: 30px; + color: ${props => props.theme.linkColor}; +`; |