Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ function App() {
<>
<h1>CloudBees feature management React sample application</h1>
<div className="card">
{featureFlags.showMessage.isEnabled() && (
<p style={{color: featureFlags.fontColor.getValue(), fontSize: featureFlags.fontSize.getValue()}}>
{featureFlags.message.getValue()}
</p>
)}
<p style={{color: featureFlags.fontColor.getValue(), fontSize: featureFlags.fontSize.getValue()}}>
{featureFlags.message.getValue()}
</p>
</div>

<div className="card">
Expand All @@ -39,4 +37,4 @@ function App() {
)
}

export default App
export default App
6 changes: 2 additions & 4 deletions src/feature-management/flags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Flag, RoxString, RoxNumber} from "rox-browser";
import {RoxString, RoxNumber} from "rox-browser";

type IFeatureFlags = typeof flags

Expand All @@ -7,12 +7,10 @@ export interface IFeatureFlagsState extends IFeatureFlags {
}

export const flags = {
// Boolean - should the message be shown?
showMessage: new Flag(),
// String - the message to show.
message: new RoxString('This is the default message; try changing some flag values!'),
// String (with options) - the color of the message text.
fontColor: new RoxString('Black', ['Red', 'Green', 'Blue', 'Black']),
// Number (with options) - the size of the message text.
fontSize: new RoxNumber(12, [12, 16, 24]),
}
}