diff options
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); |