diff options
-rw-r--r-- | packages/dev-tools-pages/ts/components/code.tsx | 9 | ||||
-rw-r--r-- | packages/dev-tools-pages/ts/components/content-block.tsx | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/packages/dev-tools-pages/ts/components/code.tsx b/packages/dev-tools-pages/ts/components/code.tsx index 9123192d9..f02ff1331 100644 --- a/packages/dev-tools-pages/ts/components/code.tsx +++ b/packages/dev-tools-pages/ts/components/code.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import styled from 'styled-components'; +import * as _ from 'lodash'; import { colors } from 'ts/variables'; @@ -49,10 +50,10 @@ const Base = CodeProps > ` font-size: .875rem; - color: ${props => (props.language === undefined ? colors.white : 'inherit')}; + color: ${props => (_.isUndefined(props.language) ? colors.white : 'inherit')}; background-color: ${props => - props.isLight ? 'rgba(255,255,255,.15)' : props.language === undefined ? colors.black : '#F1F4F5'}; - white-space: ${props => (props.language === undefined ? 'nowrap' : '')}; + props.isLight ? 'rgba(255,255,255,.15)' : _.isUndefined(props.language) ? colors.black : '#F1F4F5'}; + white-space: ${props => (_.isUndefined(props.language) ? 'nowrap' : '')}; position: relative; ${props => @@ -149,7 +150,7 @@ class Code extends React.Component<CodeProps, CodeState> { <Container> <Base language={language} isDiff={isDiff} isLight={isLight}> <StyledPre isDiff={isDiff}> - {hlCode === undefined ? ( + {_.isUndefined(hlCode) ? ( <code>{children}</code> ) : ( <StyledCodeDiff diff --git a/packages/dev-tools-pages/ts/components/content-block.tsx b/packages/dev-tools-pages/ts/components/content-block.tsx index a8c208163..3f6b024e6 100644 --- a/packages/dev-tools-pages/ts/components/content-block.tsx +++ b/packages/dev-tools-pages/ts/components/content-block.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import styled from 'styled-components'; +import * as _ from 'lodash'; import { ContextInterface } from 'ts/context'; import { media } from 'ts/variables'; @@ -69,7 +70,7 @@ const ContentBlock: React.StatelessComponent<ContentBlockProps> = props => { return ( <Base> <Title color={props.colors}>{props.title}</Title> - {children === undefined ? null : <Content>{children}</Content>} + {_.isUndefined(children) ? null : <Content>{children}</Content>} </Base> ); }; |