mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 17:49:09 +00:00
feat(editor): add basis of role editor pane
This commit is contained in:
parent
c8adad6c81
commit
5fcac53be2
34 changed files with 524 additions and 8 deletions
1
src/common/utils/featureFlags/go/featureflags.go
Normal file
1
src/common/utils/featureFlags/go/featureflags.go
Normal file
|
@ -0,0 +1 @@
|
|||
package featureflags
|
7
src/common/utils/featureFlags/react/BUILD.bazel
Normal file
7
src/common/utils/featureFlags/react/BUILD.bazel
Normal file
|
@ -0,0 +1,7 @@
|
|||
load("//hack/bazel/js:react.bzl", "react_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
react_library(
|
||||
name = "react",
|
||||
)
|
19
src/common/utils/featureFlags/react/FeatureFlags.tsx
Normal file
19
src/common/utils/featureFlags/react/FeatureFlags.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import * as React from 'react';
|
||||
|
||||
export enum FeatureFlag {
|
||||
AllowListsBlockLists = 'AllowListsBlockLists',
|
||||
}
|
||||
|
||||
export class FeatureFlagProvider {
|
||||
activeFlags: FeatureFlag[] = [];
|
||||
|
||||
constructor(flags: FeatureFlag[] = []) {
|
||||
this.activeFlags = flags;
|
||||
}
|
||||
|
||||
has(flag: FeatureFlag) {
|
||||
return this.activeFlags.includes(flag);
|
||||
}
|
||||
}
|
||||
|
||||
export const FeatureFlagsContext = React.createContext(new FeatureFlagProvider());
|
1
src/common/utils/featureFlags/react/index.ts
Normal file
1
src/common/utils/featureFlags/react/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from './FeatureFlags';
|
12
src/common/utils/featureFlags/react/storyDecorator.tsx
Normal file
12
src/common/utils/featureFlags/react/storyDecorator.tsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
import * as React from 'react';
|
||||
import { FeatureFlag, FeatureFlagProvider, FeatureFlagsContext } from './FeatureFlags';
|
||||
|
||||
export const FeatureFlagDecorator = (flags: FeatureFlag[]) => (
|
||||
storyFn: () => React.ReactNode
|
||||
) => {
|
||||
return (
|
||||
<FeatureFlagsContext.Provider value={new FeatureFlagProvider(flags)}>
|
||||
{storyFn()}
|
||||
</FeatureFlagsContext.Provider>
|
||||
);
|
||||
};
|
|
@ -4,6 +4,4 @@ package(default_visibility = ["//visibility:public"])
|
|||
|
||||
react_library(
|
||||
name = "withContext",
|
||||
deps = [
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue