Merge pull request #11957 from influxdata/feat/feature-flag

Some clean up on feature flag component
pull/11963/head
Brandon Farmer 2019-02-15 16:45:25 -08:00 committed by GitHub
commit 79dfbb6875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -1,16 +1,19 @@
import {SFC} from 'react'
import {PureComponent} from 'react'
interface Props {
name?: string
children?: any
}
const FeatureFlag: SFC<Props> = props => {
if (process.env.NODE_ENV === 'development') {
return props.children
export default class extends PureComponent<Props> {
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