Skip to content

Commit 8c91448

Browse files
committed
fix(featureflag): add dds prefix to react feature flags
1 parent 544e1f7 commit 8c91448

File tree

19 files changed

+41
-40
lines changed

19 files changed

+41
-40
lines changed

packages/patterns-react/docs/feature-flags.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For example:
4444
```javascript
4545
import React from 'react';
4646
import PropTypes from 'prop-types';
47-
import { FOOTER_LOCALE_BUTTON } from '../../internal/FeatureFlags.js';
47+
import { DDS_FOOTER_LOCALE_BUTTON } from '../../internal/FeatureFlags.js';
4848
import { featureFlag } from '@carbon/ibmdotcom-utilities';
4949

5050
/**
@@ -64,7 +64,7 @@ feature flag:
6464

6565
```javascript
6666
import React from 'react';
67-
import { FOOTER_LOCALE_BUTTON } from '../../internal/FeatureFlags.js';
67+
import { DDS_FOOTER_LOCALE_BUTTON } from '../../internal/FeatureFlags.js';
6868
import { featureFlag } from '@carbon/ibmdotcom-utilities';
6969
import FeatureName from './FeatureName';
7070

packages/react/.env.example

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ SCROLL_TRACKING=<boolean to enable scroll tracking, e.g. false>
1919

2020
#Feature Flags
2121
DDS_FLAGS_ALL=<Boolean flag to turn on all feature flags>
22-
FOOTER_LOCALE_BUTTON=<Boolean flag to turn on/off the locale selector>
23-
BUTTON_GROUP=<Boolean flag to turn on/off the ButtonGroup component>
24-
CARD_LINK=<Boolean flag to turn on/off the CardLink component>
25-
MASTHEAD_L1=<Boolean flag to turn on/off the masthead L1>
26-
DDS_TOC=<Boolean flag to turn on/off the TableOfContents component>
22+
23+
DDS_BUTTON_GROUP=<Boolean flag to turn on/off the ButtonGroup component>
24+
DDS_CARD_LINK=<Boolean flag to turn on/off the CardLink component>
25+
DDS_FOOTER_LOCALE_BUTTON=<Boolean flag to turn on/off the locale selector>
2726
DDS_LEADSPACE_CENTERED=<Boolean flag to turn on/off the LeadSpaceCentered component>
27+
DDS_MASTHEAD_L1=<Boolean flag to turn on/off the masthead L1>
28+
DDS_TOC=<Boolean flag to turn on/off the TableOfContents component>
2829

2930
# Geolocation
3031
GEO_API=<endpoint for getting user country by geolocation>

packages/react/src/components/ButtonGroup/ButtonGroup.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React from 'react';
88
import PropTypes from 'prop-types';
99
import { Button } from 'carbon-components-react';
1010
import { settings } from 'carbon-components';
11-
import { BUTTON_GROUP } from '../../internal/FeatureFlags';
11+
import { DDS_BUTTON_GROUP } from '../../internal/FeatureFlags';
1212
import {
1313
featureFlag,
1414
settings as ddsSettings,
@@ -29,7 +29,7 @@ const { prefix } = settings;
2929
*/
3030
const ButtonGroup = ({ buttons }) => {
3131
return featureFlag(
32-
BUTTON_GROUP,
32+
DDS_BUTTON_GROUP,
3333
<ol
3434
className={`${prefix}--buttongroup`}
3535
data-autoid={`${stablePrefix}--button-group`}>

packages/react/src/components/ButtonGroup/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ To utilize the following features, set the following variable's to `true` within
100100
your `.env` file or your application build settings.
101101

102102
```
103-
BUTTON_GROUP=true
103+
DDS_BUTTON_GROUP=true
104104
```
105105

106106
> See

packages/react/src/components/ButtonGroup/__stories__/ButtonGroup.stories.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { ArrowRight20, ArrowDown20, Pdf20 } from '@carbon/icons-react';
55
import '@carbon/grid/scss/grid.scss';
66
import '../../../../../styles/scss/components/buttongroup/_buttongroup.scss';
77
import readme from '../README.md';
8-
import { BUTTON_GROUP } from '../../../internal/FeatureFlags';
8+
import { DDS_BUTTON_GROUP } from '../../../internal/FeatureFlags';
99

1010
import ButtonGroup from '../ButtonGroup';
1111

12-
if (BUTTON_GROUP) {
12+
if (DDS_BUTTON_GROUP) {
1313
storiesOf('ButtonGroup', module)
1414
.addDecorator(withKnobs)
1515
.addParameters({

packages/react/src/components/ButtonGroup/__tests__/ButtonGroup.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { mount } from 'enzyme';
33
import ButtonGroup from '../ButtonGroup';
44

55
jest.mock('../../../internal/FeatureFlags', () => ({
6-
BUTTON_GROUP: true,
6+
DDS_BUTTON_GROUP: true,
77
}));
88

99
describe('<ButtonGroup />', () => {

packages/react/src/components/CardLink/CardLink.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import { CARD_LINK } from '../../internal/FeatureFlags.js';
8+
import { DDS_CARD_LINK } from '../../internal/FeatureFlags.js';
99
import { featureFlag } from '@carbon/ibmdotcom-utilities';
1010

1111
import React from 'react';
@@ -30,7 +30,7 @@ const CardLink = ({ title, href, content, icon, className, ...props }) => {
3030
}
3131

3232
return featureFlag(
33-
CARD_LINK,
33+
DDS_CARD_LINK,
3434
<ClickableTile
3535
data-autoid={`${stablePrefix}--card-link`}
3636
className={classNames(`${prefix}--card-link`, className)}

packages/react/src/components/CardLink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ To utilize the following features, set the following variable's to `true` within
4444
your `.env` file or your application build settings.
4545

4646
```
47-
CARD_LINK=true
47+
DDS_CARD_LINK=true
4848
```
4949

5050
> See

packages/react/src/components/CardLink/__stories__/Card.stories.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { withKnobs, select, text } from '@storybook/addon-knobs';
44
import { CardLink } from '../';
55
import { ArrowRight20 } from '@carbon/icons-react';
66
import readme from '../README.md';
7-
import { CARD_LINK } from '../../../internal/FeatureFlags';
7+
import { DDS_CARD_LINK } from '../../../internal/FeatureFlags';
88

99
import '../../../../../styles/scss/components/card-link/index.scss';
1010
import '@carbon/grid/scss/index.scss';
1111

12-
if (CARD_LINK) {
12+
if (DDS_CARD_LINK) {
1313
storiesOf('Card', module)
1414
.addDecorator(withKnobs)
1515
.addDecorator(Story => {

packages/react/src/components/CardLink/__tests__/CardLink.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ArrowRight20 } from '@carbon/icons-react';
1313
require('../../../internal/FeatureFlags.js');
1414

1515
jest.mock('../../../internal/FeatureFlags.js', () => ({
16-
CARD_LINK: true,
16+
DDS_CARD_LINK: true,
1717
}));
1818

1919
const content = {

packages/react/src/components/DotcomShell/__stories__/DotcomShell.stories.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import mastheadKnobs from '../../Masthead/__stories__/data/Masthead.stories.knob
66
import readme from '../README.md';
77
import '../../../../../styles/scss/components/dotcom-shell/_dotcom-shell.scss';
88
import content from './data/content';
9-
import { MASTHEAD_L1 } from '../../../internal/FeatureFlags';
9+
import { DDS_MASTHEAD_L1 } from '../../../internal/FeatureFlags';
1010

1111
const footer = {
1212
default: 'default',
@@ -21,7 +21,7 @@ storiesOf('Dotcom Shell', module)
2121
},
2222
})
2323
.add('Default', () => {
24-
const mastheadL1Props = MASTHEAD_L1 && {
24+
const mastheadL1Props = DDS_MASTHEAD_L1 && {
2525
title: text('Title', 'Stock Charts'),
2626
eyebrowText: text('Eyebrow text', 'Eyebrow'),
2727
eyebrowLink: text('Eyebrow link', '#'),

packages/react/src/components/Footer/LocaleButton.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FOOTER_LOCALE_BUTTON } from '../../internal/FeatureFlags.js';
1+
import { DDS_FOOTER_LOCALE_BUTTON } from '../../internal/FeatureFlags.js';
22
import { featureFlag } from '@carbon/ibmdotcom-utilities';
33

44
import React, { useState, useEffect } from 'react';
@@ -56,7 +56,7 @@ const LocaleButton = ({ selectItem }) => {
5656
};
5757

5858
return featureFlag(
59-
FOOTER_LOCALE_BUTTON,
59+
DDS_FOOTER_LOCALE_BUTTON,
6060
<div className={`${prefix}--locale-btn__container`}>
6161
<Button
6262
data-autoid={`${stablePrefix}--locale-btn`}

packages/react/src/components/Footer/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ To utilize the following features, set the following variable's to `true` within
4040
your `.env` file or your application build settings.
4141

4242
```
43-
FOOTER_LOCALE_BUTTON=true
43+
DDS_FOOTER_LOCALE_BUTTON=true
4444
```
4545

4646
> See

packages/react/src/components/Footer/__tests__/LocaleButton.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import mocklist from '../__data__/locale-list.json';
1414
require('../../../internal/FeatureFlags.js');
1515

1616
jest.mock('../../../internal/FeatureFlags.js', () => ({
17-
FOOTER_LOCALE_BUTTON: true,
17+
DDS_FOOTER_LOCALE_BUTTON: true,
1818
}));
1919

2020
jest.mock('@carbon/ibmdotcom-services', () => ({

packages/react/src/components/Masthead/Masthead.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import MastheadProfile from './MastheadProfile';
3030
import MastheadLeftNav from './MastheadLeftNav';
3131
import MastheadTopNav from './MastheadTopNav';
3232
import cx from 'classnames';
33-
import { MASTHEAD_L1 } from '../../internal/FeatureFlags';
33+
import { DDS_MASTHEAD_L1 } from '../../internal/FeatureFlags';
3434

3535
const { stablePrefix } = ddsSettings;
3636
const { prefix } = settings;
@@ -205,7 +205,7 @@ const Masthead = ({ navigation, hasProfile, hasSearch, ...mastheadProps }) => {
205205
)}
206206
</Header>
207207
</div>
208-
{MASTHEAD_L1 && navigation && (
208+
{DDS_MASTHEAD_L1 && navigation && (
209209
<div ref={mastheadL1Ref}>
210210
<MastheadL1
211211
isShort={isMastheadSticky}

packages/react/src/components/Masthead/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To utilize the following features, set the following variable's to `true` within
3939
your `.env` file or your application build settings.
4040

4141
```
42-
MASTHEAD_L1=true
42+
DDS_MASTHEAD_L1=true
4343
```
4444

4545
> See

packages/react/src/components/Masthead/__stories__/Masthead.stories.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Masthead from '../Masthead';
55
import mastheadKnobs from './data/Masthead.stories.knobs.js';
66
import readme from '../README.md';
77
import '../../../../../styles/scss/components/masthead/index.scss';
8-
import { MASTHEAD_L1 } from '../../../internal/FeatureFlags';
8+
import { DDS_MASTHEAD_L1 } from '../../../internal/FeatureFlags';
99

1010
storiesOf('Masthead', module)
1111
.addDecorator(withKnobs)
@@ -29,7 +29,7 @@ storiesOf('Masthead', module)
2929
hasProfile: boolean('Has profile', true),
3030
hasSearch: boolean('Has search', true),
3131
};
32-
const mastheadL1Props = MASTHEAD_L1 && {
32+
const mastheadL1Props = DDS_MASTHEAD_L1 && {
3333
title: text('Title', 'Stock Charts'),
3434
eyebrowText: text('Eyebrow text', 'Eyebrow'),
3535
eyebrowLink: text('Eyebrow link', '#'),
@@ -57,7 +57,7 @@ storiesOf('Masthead', module)
5757
hasProfile: boolean('Has profile', true),
5858
hasSearch: boolean('Has search', true),
5959
};
60-
const mastheadL1Props = MASTHEAD_L1 && {
60+
const mastheadL1Props = DDS_MASTHEAD_L1 && {
6161
title: text('Title', 'Stock Charts'),
6262
eyebrowText: text('Eyebrow text', 'Eyebrow'),
6363
eyebrowLink: text('Eyebrow link', '#'),

packages/react/src/internal/FeatureFlags.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@ export const DDS_FLAGS_ALL = process.env.DDS_FLAGS_ALL === 'true' || false;
2121
*
2222
* @type {boolean}
2323
*/
24-
export const MASTHEAD_L1 =
25-
process.env.MASTHEAD_L1 === 'true' || DDS_FLAGS_ALL || false;
24+
export const DDS_MASTHEAD_L1 =
25+
process.env.DDS_MASTHEAD_L1 === 'true' || DDS_FLAGS_ALL || false;
2626

2727
/**
2828
* This determines if the locale selector will be rendered or not
2929
*
3030
* @type {string | boolean}
3131
*/
32-
export const FOOTER_LOCALE_BUTTON =
33-
process.env.FOOTER_LOCALE_BUTTON === 'true' || DDS_FLAGS_ALL || false;
32+
export const DDS_FOOTER_LOCALE_BUTTON =
33+
process.env.DDS_FOOTER_LOCALE_BUTTON === 'true' || DDS_FLAGS_ALL || false;
3434

3535
/**
3636
* This flag turns on/off the ButtonGroup component
3737
*
3838
* @type {string | boolean}
3939
*/
40-
export const BUTTON_GROUP =
41-
process.env.BUTTON_GROUP === 'true' || DDS_FLAGS_ALL || false;
40+
export const DDS_BUTTON_GROUP =
41+
process.env.DDS_BUTTON_GROUP === 'true' || DDS_FLAGS_ALL || false;
4242

4343
/**
4444
* Feature flag for CardLink component
4545
* @type {boolean}
4646
*/
47-
export const CARD_LINK =
48-
process.env.CARD_LINK === 'true' || DDS_FLAGS_ALL || false;
47+
export const DDS_CARD_LINK =
48+
process.env.DDS_CARD_LINK === 'true' || DDS_FLAGS_ALL || false;
4949

5050
/**
5151
* This determines if the tableofcontents will be rendered or not

packages/utilities/src/utilities/featureflag/featureflag.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @private
77
* @returns {object} JSX object
88
*
9-
* return featureFlag(FOOTER_LOCALE_BUTTON, <div>hello world</div>);
9+
* return featureFlag(DDS_FOOTER_LOCALE_BUTTON, <div>hello world</div>);
1010
*
1111
*/
1212
function featureFlag(flag, jsx) {

0 commit comments

Comments
 (0)