From ea1805058924e12a18bcc4f9de712bfade64c595 Mon Sep 17 00:00:00 2001 From: August Skare Date: Tue, 20 Nov 2018 15:10:59 +0100 Subject: use lodash isUndefined function --- packages/dev-tools-pages/ts/components/code.tsx | 9 +++++---- 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 { - {hlCode === undefined ? ( + {_.isUndefined(hlCode) ? ( {children} ) : ( = props => { return ( {props.title} - {children === undefined ? null : {children}} + {_.isUndefined(children) ? null : {children}} ); }; -- cgit v1.2.3