-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,514 changed files
with
61,932 additions
and
19,233 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 @@ | ||
MAPLIBRE_STYLE_URL=https://api.example.com/style.json?key=mykey |
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
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 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
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,44 @@ | ||
import type { Decorator } from '@storybook/react' | ||
|
||
import { FEATURE_FLAGS } from 'lib/constants' | ||
|
||
/** Global story decorator that is used by the theming control to | ||
* switch between themes. | ||
*/ | ||
export const withTheme: Decorator = (Story, context) => { | ||
const theme = context.globals.theme | ||
|
||
// set the body class | ||
const actualClassState = document.body.classList.contains('posthog-3000') | ||
const desiredClassState = theme !== 'legacy' | ||
|
||
if (actualClassState !== desiredClassState) { | ||
if (desiredClassState) { | ||
document.body.classList.add('posthog-3000') | ||
} else { | ||
document.body.classList.remove('posthog-3000') | ||
} | ||
} | ||
|
||
// set the feature flag | ||
const actualFeatureFlagState = window.POSTHOG_APP_CONTEXT!.persisted_feature_flags?.includes( | ||
FEATURE_FLAGS.POSTHOG_3000 | ||
) | ||
const desiredFeatureFlagState = theme !== 'legacy' | ||
|
||
if (actualFeatureFlagState !== desiredFeatureFlagState) { | ||
const currentFlags = window.POSTHOG_APP_CONTEXT!.persisted_feature_flags || [] | ||
if (desiredFeatureFlagState) { | ||
window.POSTHOG_APP_CONTEXT!.persisted_feature_flags = [...currentFlags, FEATURE_FLAGS.POSTHOG_3000] | ||
} else { | ||
window.POSTHOG_APP_CONTEXT!.persisted_feature_flags = currentFlags.filter( | ||
(f) => f !== FEATURE_FLAGS.POSTHOG_3000 | ||
) | ||
} | ||
} | ||
|
||
// set the theme | ||
document.body.setAttribute('theme', theme === 'dark' ? 'dark' : 'light') | ||
|
||
return <Story /> | ||
} |
Oops, something went wrong.