From 4d8f0cb5ca8dcc1bbcf0782d37f81eaa9f023b0a Mon Sep 17 00:00:00 2001 From: Brandon Farmer Date: Fri, 15 Feb 2019 16:38:37 -0800 Subject: [PATCH] Some clean up on feature flag component --- ui/src/shared/components/FeatureFlag.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ui/src/shared/components/FeatureFlag.tsx b/ui/src/shared/components/FeatureFlag.tsx index f78e51f17d7..1cc27d03b92 100644 --- a/ui/src/shared/components/FeatureFlag.tsx +++ b/ui/src/shared/components/FeatureFlag.tsx @@ -1,16 +1,19 @@ -import {SFC} from 'react' +import {PureComponent} from 'react' interface Props { name?: string - children?: any } -const FeatureFlag: SFC = props => { - if (process.env.NODE_ENV === 'development') { - return props.children +export default class extends PureComponent { + public render() { + if (this.isHidden) { + return null + } + + return this.props.children } - return null + private get isHidden(): boolean { + return process.env.NODE_ENV !== 'development' + } } - -export default FeatureFlag