diff options
author | Megan Pearson <megan.e.pearson@gmail.com> | 2018-10-22 20:24:53 +0800 |
---|---|---|
committer | Megan Pearson <megan.e.pearson@gmail.com> | 2018-10-22 20:28:05 +0800 |
commit | 63b53acd482d38d3015419a4996cf5c2bc1fdb50 (patch) | |
tree | b4a36468f8cda1baaeeb1b23f18fe09800104b59 /packages/dev-tools-pages/ts/components/ContentBlock.tsx | |
parent | dfa03feb43e9398dbfda8aebf96b6fb63dff0989 (diff) | |
parent | 50eee9a657fe81fa0af4652f9a5a3f1892a1f1fa (diff) | |
download | dexon-sol-tools-63b53acd482d38d3015419a4996cf5c2bc1fdb50.tar dexon-sol-tools-63b53acd482d38d3015419a4996cf5c2bc1fdb50.tar.gz dexon-sol-tools-63b53acd482d38d3015419a4996cf5c2bc1fdb50.tar.bz2 dexon-sol-tools-63b53acd482d38d3015419a4996cf5c2bc1fdb50.tar.lz dexon-sol-tools-63b53acd482d38d3015419a4996cf5c2bc1fdb50.tar.xz dexon-sol-tools-63b53acd482d38d3015419a4996cf5c2bc1fdb50.tar.zst dexon-sol-tools-63b53acd482d38d3015419a4996cf5c2bc1fdb50.zip |
Merge branch 'dev-tools-pages' into feature/variables
Diffstat (limited to 'packages/dev-tools-pages/ts/components/ContentBlock.tsx')
-rw-r--r-- | packages/dev-tools-pages/ts/components/ContentBlock.tsx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packages/dev-tools-pages/ts/components/ContentBlock.tsx b/packages/dev-tools-pages/ts/components/ContentBlock.tsx index b80fd4550..39c99f6d9 100644 --- a/packages/dev-tools-pages/ts/components/ContentBlock.tsx +++ b/packages/dev-tools-pages/ts/components/ContentBlock.tsx @@ -1,8 +1,9 @@ import * as React from 'react'; import styled from 'styled-components'; +import { withContext, Props } from './withContext'; +import { Beta, Alpha } from './Typography'; import { media } from 'ts/variables'; -import { Beta } from './Typography'; const Base = styled.div` display: flex; @@ -42,9 +43,14 @@ const Item = styled.div` } `; -interface ContentBlockProps { +const StyledTitle = styled(Alpha)` + color: ${props => props.color}; +`; + +interface ContentBlockProps extends Props { title: string; - children: React.ReactNode; + main?: boolean; + children?: React.ReactNode; } function ContentBlock(props: ContentBlockProps) { @@ -52,12 +58,14 @@ function ContentBlock(props: ContentBlockProps) { return <Item>{child}</Item>; }); + const Title = props.main ? StyledTitle : Beta; + return ( <Base> - <Beta>{props.title}</Beta> - <Content>{children}</Content> + <Title color={props.colors.main}>{props.title}</Title> + {children ? <Content>{children}</Content> : null} </Base> ); } -export default ContentBlock; +export default withContext(ContentBlock); |