diff options
author | August Skare <post@augustskare.no> | 2018-11-20 22:10:59 +0800 |
---|---|---|
committer | August Skare <post@augustskare.no> | 2018-11-20 22:10:59 +0800 |
commit | ea1805058924e12a18bcc4f9de712bfade64c595 (patch) | |
tree | cb172f39ead2ff076600dbcf53745e2bb1a34580 | |
parent | 117726c6d80dd20e8b9409cec23b0c062690b0df (diff) | |
download | dexon-sol-tools-ea1805058924e12a18bcc4f9de712bfade64c595.tar.gz dexon-sol-tools-ea1805058924e12a18bcc4f9de712bfade64c595.tar.zst dexon-sol-tools-ea1805058924e12a18bcc4f9de712bfade64c595.zip |
use lodash isUndefined function
-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> ); }; |