mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-15 00:59:09 +00:00
chore: update codestyle due to prettier/rule updates
This commit is contained in:
parent
f632bfa6e5
commit
10e095656f
16 changed files with 298 additions and 292 deletions
|
@ -1,12 +1,11 @@
|
|||
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>
|
||||
);
|
||||
};
|
||||
export const FeatureFlagDecorator =
|
||||
(flags: FeatureFlag[]) => (storyFn: () => React.ReactNode) => {
|
||||
return (
|
||||
<FeatureFlagsContext.Provider value={new FeatureFlagProvider(flags)}>
|
||||
{storyFn()}
|
||||
</FeatureFlagsContext.Provider>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import * as React from 'react';
|
||||
|
||||
export const withContext = <T, K extends T>(
|
||||
Context: React.Context<T>,
|
||||
Component: React.ComponentType<K>
|
||||
): React.FunctionComponent<K> => (props) => (
|
||||
<Context.Consumer>
|
||||
{(context) => <Component {...props} {...context} />}
|
||||
</Context.Consumer>
|
||||
);
|
||||
export const withContext =
|
||||
<T, K extends T>(
|
||||
Context: React.Context<T>,
|
||||
Component: React.ComponentType<K>
|
||||
): React.FunctionComponent<K> =>
|
||||
(props) =>
|
||||
(
|
||||
<Context.Consumer>
|
||||
{(context) => <Component {...props} {...context} />}
|
||||
</Context.Consumer>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue