All files / libs/tenants/feature-flags/components/src FeatureFlag.ts

100% Statements 36/36
100% Branches 0/0
100% Functions 0/0
100% Lines 36/36

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 371x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { FeatureFlagDisabled } from './FeatureFlagDisabled';
import { FeatureFlagEnabled } from './FeatureFlagEnabled';
 
/**
 * @example
 *
 * Display a component when a feature flag is enabled:
 *
 * ```tsx
 *   <FeatureFlag.Enabled
 *     featureFlag={CompanyFeature.BADGES}
 *   >
 *    <p>Enabled</p>
 *  </FeatureFlag.Enabled>
 * ```
 *
 * This will render `<p>Enabled</p>` when the feature flag BADGES is truthy (true).
 *
 * @example
 *
 * Display a component when a feature flag is disabled:
 *
 * ```tsx
 *  <FeatureFlag.Disabled
 *   featureFlag={CompanyFeature.BADGES}
 * >
 *   <p>Disabled</p>
 * </FeatureFlag.Disabled>
 * ```
 *
 * This will render `<p>Disabled</p>` when the feature flag "BADGES" is falsy (false when cast to boolean).
 */
export const FeatureFlag = {
  Enabled: FeatureFlagEnabled,
  Disabled: FeatureFlagDisabled,
};