diff options
author | Megan Pearson <megan.e.pearson@gmail.com> | 2018-10-22 20:11:20 +0800 |
---|---|---|
committer | Megan Pearson <megan.e.pearson@gmail.com> | 2018-10-22 20:11:20 +0800 |
commit | 50eee9a657fe81fa0af4652f9a5a3f1892a1f1fa (patch) | |
tree | 69befae2cf8c87d0bd97bb8e9917515c6033924f /packages/dev-tools-pages/ts/components/ContentBlock.tsx | |
parent | 580e574c841fb9b0ba9d37a50bd5a0f787799ff2 (diff) | |
parent | 917952bc2aac353a2375e1fd7906ed14b81a6830 (diff) | |
download | dexon-sol-tools-50eee9a657fe81fa0af4652f9a5a3f1892a1f1fa.tar.gz dexon-sol-tools-50eee9a657fe81fa0af4652f9a5a3f1892a1f1fa.tar.zst dexon-sol-tools-50eee9a657fe81fa0af4652f9a5a3f1892a1f1fa.zip |
Merge branch 'feature/alternate-main' into dev-tools-pages
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 56d52a150..fa558e9ab 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,9 +27,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) { @@ -36,12 +42,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); |