Skip to content

Commit

Permalink
Merge pull request #11957 from influxdata/feat/feature-flag
Browse files Browse the repository at this point in the history
Some clean up on feature flag component
  • Loading branch information
bthesorceror authored Feb 16, 2019
2 parents d471b49 + 4d8f0cb commit 79dfbb6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions ui/src/shared/components/FeatureFlag.tsx
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 79dfbb6

Please sign in to comment.