Skip to content

Commit a61e1eb

Browse files
committed
[AppProvider] Consolidate se23 logic
1 parent b037ca7 commit a61e1eb

File tree

8 files changed

+6
-54
lines changed

8 files changed

+6
-54
lines changed

polaris-react/.storybook/preview.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ function AppProviderDecorator(Story, context) {
3232
if (context.args.omitAppProvider) return <Story {...context} />;
3333

3434
return (
35-
<AppProvider
36-
theme={context.globals.theme}
37-
features={{
38-
polarisSummerEditions2023: true,
39-
}}
40-
i18n={enTranslations}
41-
>
35+
<AppProvider theme={context.globals.theme} i18n={enTranslations}>
4236
<FrameContext.Provider value={{}}>
4337
<Story {...context} />
4438
</FrameContext.Provider>

polaris-react/src/components/AppProvider/AppProvider.stories.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export function Default(_, context) {
3434
},
3535
},
3636
}}
37-
features={{
38-
polarisSummerEditions2023: true,
39-
}}
4037
>
4138
<Page>
4239
<LegacyCard>
@@ -97,9 +94,6 @@ export function WithI18n(_, context) {
9794
},
9895
},
9996
}}
100-
features={{
101-
polarisSummerEditions2023: true,
102-
}}
10397
>
10498
<Page>
10599
<LegacyCard>
@@ -155,13 +149,7 @@ export function WithLinkComponent(_, context) {
155149
};
156150

157151
return (
158-
<AppProvider
159-
linkComponent={CustomLinkComponent}
160-
i18n={{}}
161-
features={{
162-
polarisSummerEditions2023: true,
163-
}}
164-
>
152+
<AppProvider linkComponent={CustomLinkComponent} i18n={{}}>
165153
<Page
166154
backAction={{content: 'Products', url: '#'}}
167155
title="Jar With Lock-Lid"

polaris-react/src/components/AppProvider/AppProvider.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,10 @@ export class AppProvider extends Component<AppProviderProps, State> {
148148
document.documentElement.classList.add(classNamePolarisSummerEditions2023);
149149
};
150150

151-
getFeatures = () => {
152-
const {features} = this.props;
153-
154-
return {
155-
...features,
156-
polarisSummerEditions2023: features?.polarisSummerEditions2023 ?? true,
157-
};
158-
};
159-
160151
getThemeName = (): ThemeName => this.props.theme ?? themeNameDefault;
161152

162153
render() {
163-
const {children} = this.props;
164-
const features = this.getFeatures();
154+
const {children, features} = this.props;
165155
const themeName = this.getThemeName();
166156

167157
const {intl, link} = this.state;

polaris-react/src/components/Frame/Frame.stories.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ function InAnApplicationComponent() {
357357
},
358358
},
359359
}}
360-
features={{polarisSummerEditions2023: true}}
361360
>
362361
<Frame
363362
logo={logo}
@@ -701,7 +700,6 @@ function WithAnOffsetComponent() {
701700
},
702701
},
703702
}}
704-
features={{polarisSummerEditions2023: true}}
705703
>
706704
<Frame
707705
logo={logo}
@@ -1060,7 +1058,6 @@ function WithSidebarEnabled() {
10601058
},
10611059
},
10621060
}}
1063-
features={{polarisSummerEditions2023: true}}
10641061
>
10651062
<Frame
10661063
logo={logo}

polaris-react/src/components/Pagination/tests/Pagination.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ describe('<Pagination />', () => {
295295
label="Hello, world!"
296296
type="page"
297297
/>,
298-
{features: {polarisSummerEditions2023: false}},
299298
);
300299

301300
expect(pagination).toContainReactComponent(ButtonGroup, {

polaris-react/src/components/PolarisTestProvider/PolarisTestProvider.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,13 @@ export function PolarisTestProvider({
6565

6666
const stickyManager = useMemo(() => new StickyManager(), []);
6767

68-
const featuresConfig = useMemo(
69-
() => ({
70-
polarisSummerEditions2023: true,
71-
...features,
72-
}),
73-
[features],
74-
);
75-
7668
const mergedFrame = createFrameContext(frame);
7769

7870
const mergedMediaQuery = merge(defaultMediaQuery, mediaQuery);
7971

8072
return (
8173
<Wrapper>
82-
<FeaturesContext.Provider value={featuresConfig}>
74+
<FeaturesContext.Provider value={features}>
8375
<I18nContext.Provider value={intl}>
8476
<ScrollLockManagerContext.Provider value={scrollLockManager}>
8577
<StickyManagerContext.Provider value={stickyManager}>

polaris-react/src/utilities/features/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export interface FeaturesConfig {
2-
polarisSummerEditions2023?: boolean;
32
[key: string]: boolean | undefined;
43
}
54

polaris-react/tests/utilities/react-testing.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,9 @@ export const mountWithApp = createMount<
2222
return options;
2323
},
2424
render(element, context) {
25-
const {features, ...rest} = context;
25+
const {...rest} = context;
2626
return (
27-
<PolarisTestProvider
28-
i18n={translations}
29-
features={{
30-
polarisSummerEditions2023: true,
31-
...features,
32-
}}
33-
{...rest}
34-
>
27+
<PolarisTestProvider i18n={translations} {...rest}>
3528
{element}
3629
</PolarisTestProvider>
3730
);

0 commit comments

Comments
 (0)