-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docs): create a feature flag component for to wrap the content
Added an example in button.mdx to define what will be displayed. - alpha: feedback round - rc: documentation release - next: in next iteration
- Loading branch information
Franck Gaudin
committed
Jul 4, 2024
1 parent
344ad0a
commit 6505baf
Showing
5 changed files
with
50 additions
and
27 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,17 @@ | ||
"use client"; | ||
|
||
import { useContext, type ReactNode } from "react"; | ||
import { FeatureFlagContext } from "@/context/feature/FeatureFlagProvider.tsx"; | ||
|
||
interface FeatureFlagProps { | ||
flag: string; | ||
children: ReactNode; | ||
} | ||
|
||
const FeatureFlag = ({ flag, children }: FeatureFlagProps) => { | ||
const featureFlags = useContext(FeatureFlagContext); | ||
|
||
return featureFlags[flag] ? children : null; | ||
}; | ||
|
||
export default FeatureFlag; |
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
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,5 @@ | ||
export const flags = { | ||
alpha: process.env.NEXT_PUBLIC_ALPHA === "true", | ||
rc: process.env.NEXT_PUBLIC_RC === "true", | ||
next: process.env.NEXT_PUBLIC_NEXT === "true" | ||
}; |