Skip to content

Commit

Permalink
feat(feature-flag): add feature flag from gb
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin authored and seaerchin committed Aug 30, 2023
1 parent 4f03e6f commit 20c96ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/constants/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const FEATURE_FLAGS = {
STYLING_REVAMP: "styles",
} as const
10 changes: 5 additions & 5 deletions src/layouts/FeatureFlaggedContactUs.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useFeatureIsOn } from "@growthbook/growthbook-react"
import { useParams } from "react-router-dom"

import { OGP_SITES, TESTING_SITES } from "constants/sites"
import { FEATURE_FLAGS } from "constants/featureFlags"

import EditContactUs from "./EditContactUs"
import LegacyEditContactUs from "./LegacyEditContactUs"

export const FeatureFlaggedContactUs = (): JSX.Element => {
const params = useParams<{ siteName: string }>()
const isOgpSite =
OGP_SITES.includes(params.siteName) ||
TESTING_SITES.includes(params.siteName)
return isOgpSite ? (
const shouldShowNewStyles = useFeatureIsOn(FEATURE_FLAGS.STYLING_REVAMP)

return shouldShowNewStyles ? (
<EditContactUs match={{ params }} />
) : (
<LegacyEditContactUs match={{ params }} />
Expand Down
10 changes: 5 additions & 5 deletions src/layouts/FeatureFlaggedHomepage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useFeatureIsOn } from "@growthbook/growthbook-react"
import { useParams } from "react-router-dom"

import { OGP_SITES, TESTING_SITES } from "constants/sites"
import { FEATURE_FLAGS } from "constants/featureFlags"

import EditHomepage from "./EditHomepage"
import LegacyEditHomepage from "./LegacyEditHomepage/LegacyEditHomepage"

export const FeatureFlaggedHomepage = (): JSX.Element => {
const params = useParams<{ siteName: string }>()
const isOgpSite =
OGP_SITES.includes(params.siteName) ||
TESTING_SITES.includes(params.siteName)
return isOgpSite ? (
const shouldShowNewStyles = useFeatureIsOn(FEATURE_FLAGS.STYLING_REVAMP)

return shouldShowNewStyles ? (
<EditHomepage match={{ params }} />
) : (
<LegacyEditHomepage match={{ params }} />
Expand Down

0 comments on commit 20c96ad

Please sign in to comment.