-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11957 from influxdata/feat/feature-flag
Some clean up on feature flag component
- Loading branch information
Showing
1 changed file
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |