From a5d0066d0016056ca0d01ad8bebef76b35848280 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 5 Oct 2018 17:28:03 +0100 Subject: Convert TutorialButton to styled component --- .../components/documentation/tutorial_button.tsx | 109 +++++++++------------ 1 file changed, 45 insertions(+), 64 deletions(-) (limited to 'packages/website/ts/components') diff --git a/packages/website/ts/components/documentation/tutorial_button.tsx b/packages/website/ts/components/documentation/tutorial_button.tsx index a0d99e175..9c13ec732 100644 --- a/packages/website/ts/components/documentation/tutorial_button.tsx +++ b/packages/website/ts/components/documentation/tutorial_button.tsx @@ -1,79 +1,60 @@ import { colors, Link } from '@0xproject/react-shared'; import * as _ from 'lodash'; import * as React from 'react'; +import { Container } from 'ts/components/ui/container'; import { Text } from 'ts/components/ui/text'; import { Deco, Key, TutorialInfo } from 'ts/types'; import { Translate } from 'ts/utils/translate'; +import { darken, saturate } from 'polished'; +import { styled } from 'ts/style/theme'; + export interface TutorialButtonProps { + className?: string; translate: Translate; tutorialInfo: TutorialInfo; } -export interface TutorialButtonState { - isHovering: boolean; -} - -export class TutorialButton extends React.Component { - constructor(props: TutorialButtonProps) { - super(props); - this.state = { - isHovering: false, - }; - } - public render(): React.ReactNode { - return ( - -
-
- -
-
- - {this.props.translate.get(this.props.tutorialInfo.link.title as Key, Deco.Cap)} - - - {this.props.translate.get(this.props.tutorialInfo.description as Key, Deco.Cap)} - -
-
-
- -
+const PlainTutorialButton: React.StatelessComponent = ({ translate, tutorialInfo, className }) => ( + + +
+
+ +
+
+ + {translate.get(tutorialInfo.link.title as Key, Deco.Cap)} + + + {translate.get(tutorialInfo.description as Key, Deco.Cap)} + +
+
+
+
- - ); - } - private _onHover(_event: React.FormEvent): void { - if (this.state.isHovering) { - return; - } - this.setState({ - isHovering: true, - }); - } - private _onHoverOff(): void { - this.setState({ - isHovering: false, - }); +
+ +
+); + +export const TutorialButton = styled(PlainTutorialButton)` + border-radius: 4px; + border: 1px solid ${colors.grey325}; + background-color: ${colors.white}; + &:hover { + border: 1px solid ${colors.lightLinkBlue}; + background-color: ${colors.lightestBlue}; } -} + padding: 20px; + margin-bottom: 15px; +`; + +TutorialButton.defaultProps = {}; + +TutorialButton.displayName = 'TutorialButton'; -- cgit