Updates Intro Component to use IntroBody and IntroAside

This commit is contained in:
Megan Pearson
2018-10-23 16:05:28 +02:00
committed by August Skare
parent 1ae9f68db8
commit 16b5157078
2 changed files with 37 additions and 19 deletions

View File

@@ -4,7 +4,6 @@ import { media, colors } from '../variables';
import { Alpha, Lead } from './Typography'; import { Alpha, Lead } from './Typography';
import Container from './Container'; import Container from './Container';
import Code from './Code';
const Main = styled.div` const Main = styled.div`
background-color: ${colors.lightGray}; background-color: ${colors.lightGray};
@@ -18,46 +17,56 @@ const Main = styled.div`
`}; `};
`; `;
const Inner = styled.div`
display: flex;
flex-direction: column;
width: 100%;
`;
const Title = styled(Alpha)` const Title = styled(Alpha)`
margin-bottom: 2.5rem; margin-bottom: 2.5rem;
${media.small`margin-bottom: 2.25rem;`}; ${media.small`margin-bottom: 2.25rem;`};
`; `;
const Content = styled.div` const Blocks = styled.div`
max-width: 25.9375rem;
display: flex; display: flex;
flex-direction: column; justify-content: space-between;
${Lead} { ${media.small`display: block;`};
${media.small`margin-bottom: 2.25rem;`};
}
`; `;
const StyledCode = styled(Code)` const IntroLead = styled(Lead)`
width: 520px; max-width: 25.9375rem;
height: 350px;
${media.small`margin-bottom: 2.25rem;`}; ${media.small`margin-bottom: 1.5625rem;`};
`;
const IntroAside = styled.div`
max-width: 32.5rem;
${media.small`
margin-left: -30px;
width: calc(100% + 60px);
`};
`; `;
interface IntroProps { interface IntroProps {
title: string; title: string;
children: React.ReactNode; children?: React.ReactNode;
} }
function Intro(props: IntroProps) { function Intro(props: IntroProps) {
return ( return (
<Container wide> <Container wide>
<Main> <Main>
<Content> <Inner>
<Title>{props.title}</Title> <Title>{props.title}</Title>
<Lead as="div">{props.children}</Lead> <Blocks>{props.children}</Blocks>
</Content> </Inner>
<StyledCode> Function execute transaction</StyledCode>
</Main> </Main>
</Container> </Container>
); );
} }
export default Intro; export default Intro;
export { IntroLead, IntroAside, Intro };

View File

@@ -9,19 +9,28 @@ import { Tabs, TabBlock } from 'ts/components/Tabs';
import Code from 'ts/components/Code'; import Code from 'ts/components/Code';
import InlineCode from 'ts/components/InlineCode'; import InlineCode from 'ts/components/InlineCode';
import { List, ListItem } from 'ts/components/List'; import { List, ListItem } from 'ts/components/List';
import Intro from 'ts/components/Intro';
import Breakout from 'ts/components/Breakout'; import Breakout from 'ts/components/Breakout';
import { Intro, IntroLead, IntroAside } from 'ts/components/Intro';
function Cov() { function Cov() {
return ( return (
<Base context={context}> <Base context={context}>
<Intro title="Measure your tests"> <Intro title="Measure your tests">
<p> <IntroLead>
When it comes to writing smart contracts, testing is one of the most important steps of the process. When it comes to writing smart contracts, testing is one of the most important steps of the process.
In order to quantify the robustness of your Solidity testing suite, you need to measure its code In order to quantify the robustness of your Solidity testing suite, you need to measure its code
coverage. coverage.
</p> </IntroLead>
<IntroAside>
<Code language="js">
{`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);`}
</Code>
</IntroAside>
</Intro> </Intro>
<Content> <Content>
<ContentBlock main title="Get started" /> <ContentBlock main title="Get started" />
<ContentBlock title="Prerequisites"> <ContentBlock title="Prerequisites">