Skip to content

Commit 340e36e

Browse files
authored
[AppProvider] Consolidate se23 logic (#10635)
### WHY are these changes introduced? Resolves #9915. Resolves #10189. Resolves #10190. Resolves #10192. Resolves #10193. Consolidates se23 logic (passing in `polarisSummerEditions2023` to `features`) in AppProvider and related components. ### WHAT is this pull request doing? Removes se23 flag from features and consolidates se23 comments. Adds comment with warning to discourage use of `se23` flag in `_common.scss`. ### How to 🎩 [Storybook]() [Next branch storybook](https://5d559397bae39100201eedc1-kzivkxiyci.chromatic.com/?path=/story/playground--details-page) 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
1 parent b037ca7 commit 340e36e

File tree

11 files changed

+17
-58
lines changed

11 files changed

+17
-58
lines changed

.changeset/short-kids-buy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': major
3+
---
4+
5+
Removed `polarisSummerEditions2023` feature flag from AppProvider context

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/IndexTable/IndexTable.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ $loading-panel-height: 53px;
108108

109109
// This is to bust specificity with .Table-scrolling and TableCell:first-child or TableCell:first-child + TableCell bg color above.
110110
.TableRow-subdued {
111-
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity, selector-max-compound-selectors -- se23 overrides
111+
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity, selector-max-compound-selectors -- bg color overrides
112112
.TableCell-first,
113113
.TableCell-first + .TableCell {
114114
background-color: var(--p-color-bg-subdued);
@@ -209,7 +209,7 @@ $loading-panel-height: 53px;
209209

210210
// NOTE: `-hovered` must come after `-selected` so elements don't appear to lose their interactivity when selected.
211211
&.TableRow-hovered {
212-
// stylelint-disable selector-max-class, selector-max-specificity, selector-max-combinators -- se23 status hover styles
212+
// stylelint-disable selector-max-class, selector-max-specificity, selector-max-combinators -- status hover styles
213213
&,
214214
.TableCell-first,
215215
.TableCell-first + .TableCell {
@@ -247,7 +247,7 @@ $loading-panel-height: 53px;
247247
background-color: var(--p-color-bg-subdued-hover);
248248
}
249249
}
250-
// stylelint-enable selector-max-class, selector-max-specificity, selector-max-combinators -- se23 status hover styles
250+
// stylelint-enable selector-max-class, selector-max-specificity, selector-max-combinators -- status hover styles
251251
}
252252

253253
// stylelint-disable-next-line selector-max-class -- generated by polaris-migrator DO NOT COPY
@@ -653,7 +653,7 @@ $loading-panel-height: 53px;
653653
}
654654
// This is to bust specificity with Table-unselectable and TableCel:first-child bg color above.
655655
.TableRow-subdued:not(.TableRow-hovered) {
656-
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- se23 override
656+
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- bg color override
657657
.TableCell:first-child {
658658
background-color: var(--p-color-bg-subdued);
659659
}

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/styles/_common.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@
2323
// tag+attribute selector.
2424
// However, we're still supporting iOS 12 for embedded web views in some apps, which
2525
// unfortunately doesn't support :where https://caniuse.com/?search=%3Awhere
26+
27+
// 🚨 WARNING: Refrain from using the `se23` flag, this will be deprecated post v12.
2628
$se23: 'html[class~="Polaris-Summer-Editions-2023"]';

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

0 commit comments

Comments
 (0)