-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replaced HOC with 2 new HOCS, updated config files (#1)
- Loading branch information
1 parent
f7e4443
commit 1340952
Showing
21 changed files
with
238 additions
and
163 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist | ||
examples | ||
node_modules |
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,3 +1,2 @@ | ||
node_modules | ||
*.log | ||
dist |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
registry=http://registry.npmjs.org/ | ||
package-lock=false |
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,6 +1,15 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- "node" | ||
cache: | ||
directories: | ||
- ~/.npm | ||
notifications: | ||
email: false | ||
node_js: '8' | ||
install: yarn | ||
script: | ||
- npm run build | ||
- npm test | ||
- yarn build | ||
- yarn lint | ||
- yarn test | ||
branches: | ||
only: master |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { featureFlipperPromise } from '../../dist/react-feature-flipper'; | ||
import featureFlippersList from './features'; | ||
|
||
const Component = () => ( | ||
<div className="example-component"> | ||
<h3>Feature flipper enabled component</h3> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
</p> | ||
</div> | ||
); | ||
|
||
// FeatureFlippedComponent will be rendered if "double_column" feature enabled | ||
export default featureFlipperPromise([Component, featureFlippersList, 'double_column']); |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import featureFlipperStatic from '../../dist/react-feature-flipper'; | ||
|
||
const Component = () => ( | ||
<div className="example-component"> | ||
<h3>Feature flipper enabled component</h3> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
</p> | ||
</div> | ||
); | ||
|
||
export const ComponentFeatureFlippedStaticEnabled = featureFlipperStatic([Component]); | ||
export const ComponentFeatureFlippedStaticDisabled = featureFlipperStatic([Component, false]); |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import ComponentFeatureFlippedPromise from './ComponentFeatureFlippedPromise'; | ||
import { | ||
ComponentFeatureFlippedStaticEnabled, | ||
ComponentFeatureFlippedStaticDisabled | ||
} from './ComponentFeatureFlippedStatic'; | ||
|
||
const Container = () => ( | ||
<div className="test-container"> | ||
<ComponentFeatureFlippedPromise /> | ||
<ComponentFeatureFlippedPromise /> | ||
<div className="feature-flipper-disabled"> | ||
<h3>Feature flipper disabled element/component</h3> | ||
</div> | ||
<ComponentFeatureFlippedStaticEnabled /> | ||
<ComponentFeatureFlippedStaticDisabled /> | ||
</div> | ||
); | ||
|
||
export default Container; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -45,6 +45,7 @@ | |
background-color: white; | ||
width: 520px; | ||
padding: 20px; | ||
margin-bottom: 20px; | ||
} | ||
</style> | ||
</head> | ||
|
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,9 +1,9 @@ | ||
/* eslint-disable no-undef */ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ExampleContainer from './ExampleContainer'; | ||
import Container from './Container'; | ||
|
||
ReactDOM.render( | ||
<ExampleContainer />, | ||
<Container />, | ||
document.getElementById('root') | ||
); |
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
|
||
/** | ||
* featureFlipperStatic HOC | ||
* | ||
* @param {function} WrappedComponent Component needs to be feature flipped | ||
* @param {boolean} [isEnabled=true] boolean value to enable/disable feature | ||
* @returns {function} | ||
*/ | ||
const featureFlipperStatic = ([WrappedComponent, isEnabled = true]) => () => { | ||
if (isEnabled) { | ||
return ( | ||
<> | ||
<WrappedComponent /> | ||
</> | ||
); | ||
} | ||
return null; | ||
}; | ||
|
||
export default featureFlipperStatic; |
Oops, something went wrong.