chore: update prettier tab width for consistency

This commit is contained in:
41666 2021-03-13 22:49:01 -05:00
parent a931f8c69c
commit 9b71a24e2d
247 changed files with 7224 additions and 7375 deletions

View file

@ -3,14 +3,14 @@ import * as React from 'react';
import { FeatureGate } from './FeatureGate';
export default {
title: 'Atoms/Feature Gate',
decorators: [FeatureFlagDecorator(['AllowListBlockList'])],
title: 'Atoms/Feature Gate',
decorators: [FeatureFlagDecorator(['AllowListBlockList'])],
};
export const ActiveGate = () => (
<FeatureGate featureFlag="AllowListBlockList">{() => <div>hello!</div>}</FeatureGate>
<FeatureGate featureFlag="AllowListBlockList">{() => <div>hello!</div>}</FeatureGate>
);
export const InactiveGate = () => (
<FeatureGate featureFlag="aaa">{() => <div>hello!</div>}</FeatureGate>
<FeatureGate featureFlag="aaa">{() => <div>hello!</div>}</FeatureGate>
);

View file

@ -1,20 +1,20 @@
import {
FeatureFlag,
FeatureFlagsContext,
FeatureFlag,
FeatureFlagsContext,
} from '@roleypoly/misc-utils/featureFlags/react';
import * as React from 'react';
export type FeatureGateProps = {
featureFlag: FeatureFlag;
children: () => React.ReactNode;
featureFlag: FeatureFlag;
children: () => React.ReactNode;
};
export const FeatureGate = (props: FeatureGateProps) => {
const featureContext = React.useContext(FeatureFlagsContext);
const featureContext = React.useContext(FeatureFlagsContext);
if (featureContext.has(props.featureFlag)) {
return props.children();
} else {
return <></>;
}
if (featureContext.has(props.featureFlag)) {
return props.children();
} else {
return <></>;
}
};