From e485a9814333a3178e6a156230ed15b047f11005 Mon Sep 17 00:00:00 2001 From: August Skare Date: Mon, 22 Oct 2018 13:14:48 +0200 Subject: support dark alternative of Main component --- .../dev-tools-pages/ts/components/ContentBlock.tsx | 17 ++++-- packages/dev-tools-pages/ts/components/Main.tsx | 43 +++++++++----- packages/dev-tools-pages/ts/pages/Compiler.tsx | 69 ++++++++++++---------- 3 files changed, 79 insertions(+), 50 deletions(-) diff --git a/packages/dev-tools-pages/ts/components/ContentBlock.tsx b/packages/dev-tools-pages/ts/components/ContentBlock.tsx index 56d52a150..fcd85830e 100644 --- a/packages/dev-tools-pages/ts/components/ContentBlock.tsx +++ b/packages/dev-tools-pages/ts/components/ContentBlock.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; import styled from 'styled-components'; -import { Beta } from './Typography'; +import { withContext, Props } from './withContext'; +import { Beta, Alpha } from './Typography'; const Base = styled.div` display: flex; @@ -26,8 +27,14 @@ const Item = styled.div` } `; -interface ContentBlockProps { +const StyledTitle = styled(Alpha)` + color: ${props => props.color}; + margin-bottom: 6.25rem; +`; + +interface ContentBlockProps extends Props { title: string; + main?: boolean; children: React.ReactNode; } @@ -36,12 +43,14 @@ function ContentBlock(props: ContentBlockProps) { return {child}; }); + const Title = props.main ? StyledTitle : Beta; + return ( - {props.title} + {props.title} {children} ); } -export default ContentBlock; +export default withContext(ContentBlock); diff --git a/packages/dev-tools-pages/ts/components/Main.tsx b/packages/dev-tools-pages/ts/components/Main.tsx index 8046abc91..6c0270dbc 100644 --- a/packages/dev-tools-pages/ts/components/Main.tsx +++ b/packages/dev-tools-pages/ts/components/Main.tsx @@ -1,33 +1,44 @@ import * as React from 'react'; import styled from 'styled-components'; -import { withContext, Props } from './withContext'; +import { Beta } from './Typography'; +import Container from './Container'; +import ContentBlock from './ContentBlock'; -import { Alpha } from './Typography'; - -const StyledMain = styled.div` +const StyledMain = + styled.div < + MainProps > + ` padding-top: 6.25rem; padding-bottom: 6.25rem; + ${props => + props.dark + ? ` + background-color: #000; + color: #fff; + ` + : ''}; `; -const Title = styled(Alpha)` - color: ${props => props.color}; - margin-bottom: 6.25rem; -`; - -interface MainProps extends Props { +interface MainProps { + title?: string; + subtitle?: string; + dark?: boolean; children: React.ReactNode; } function Main(props: MainProps) { return ( - - - Get started - - {props.children} + + + + {props.subtitle ? {props.subtitle} : null} + + + {props.children} + ); } -export default withContext(Main); +export default Main; diff --git a/packages/dev-tools-pages/ts/pages/Compiler.tsx b/packages/dev-tools-pages/ts/pages/Compiler.tsx index 35c810cb3..e7336f1b1 100644 --- a/packages/dev-tools-pages/ts/pages/Compiler.tsx +++ b/packages/dev-tools-pages/ts/pages/Compiler.tsx @@ -15,40 +15,49 @@ import CompilerComponent from 'ts/components/Compiler'; function Compiler() { return ( - - -
- - - - - npm install @0x/sol-trace --save -

- Sol-trace is a subprovider that needs to be prepended to your{' '} - provider engine. Depending on your project setup, you will need to use a - specific ArtifactAdapter. Sol-trace ships with the{' '} - SolCompilerArtifactAdapter for use with Sol-compiler and{' '} - TruffleArtifactAdapter for use with the Truffle framework. You can - also write your own and support any artifact format. -

-
+ +
+ + + + + npm install @0x/sol-trace --save +

+ Sol-trace is a subprovider that needs to be prepended to your provider engine. + Depending on your project setup, you will need to use a specific ArtifactAdapter. Sol-trace + ships with the SolCompilerArtifactAdapter for use with Sol-compiler and{' '} + TruffleArtifactAdapter for use with the Truffle framework. You can also + write your own and support any artifact format. +

+
- - - - - {`import { SolCompilerArtifactAdapter } from '@0x/sol-trace'; + + + + + {`import { SolCompilerArtifactAdapter } from '@0x/sol-trace'; // Both artifactsDir and contractsDir are optional and will be fetched from compiler.json if not passed in const artifactAdapter = new SolCompilerArtifactAdapter(artifactsDir, contractsDir);`} - - - Truffle - Custom - - -
- + + + Truffle + Custom + + +
+
+ +

+ Sol compiler uses solidity standard JSON output format for the artifacts. This way, you can + define which parts of the artifact you need. +

+
+
); } -- cgit v1.2.3