Skip to content

Commit 6d46f59

Browse files
alex-pagelaurkimchloerice
authored
Remove deprecation from Grid (#8938)
### WHY are these changes introduced? Removed deprecation from `<Grid>` ### WHAT is this pull request doing? Ensure that `Grid` is available so we can update the props and align API's with checkout and others --------- Co-authored-by: Lo Kim <lo.kim@shopify.com> Co-authored-by: Chloe Rice <chloerice@users.noreply.github.com>
1 parent 3dc9640 commit 6d46f59

File tree

8 files changed

+16
-27
lines changed

8 files changed

+16
-27
lines changed

.changeset/shy-plums-give.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': minor
3+
---
4+
5+
Remove deprecation from `Grid` component

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import React, {useEffect} from 'react';
1+
import React from 'react';
22

3-
// eslint-disable-next-line import/no-deprecated
43
import {Cell} from './components';
54
import styles from './Grid.scss';
65

@@ -27,9 +26,8 @@ export interface GridProps {
2726
gap?: Gap;
2827
children?: React.ReactNode;
2928
}
30-
/** @deprecated Use `Columns` instead or a combination of layout primitives (`Columns`, `Inline`, and `AlphaStack`) */
29+
3130
export const Grid: React.FunctionComponent<GridProps> & {
32-
// eslint-disable-next-line import/no-deprecated
3331
Cell: typeof Cell;
3432
} = function Grid({gap, areas, children, columns}: GridProps) {
3533
const style = {
@@ -50,15 +48,6 @@ export const Grid: React.FunctionComponent<GridProps> & {
5048
'--pc-grid-areas-xl': formatAreas(areas?.xl),
5149
} as React.CSSProperties;
5250

53-
useEffect(() => {
54-
if (process.env.NODE_ENV === 'development') {
55-
// eslint-disable-next-line no-console
56-
console.warn(
57-
'Deprecation: <Grid /> is deprecated. This component will be removed in a future major version of Polaris. Use <Columns /> instead or a combination of <Columns />, <Inline />, and <AlphaStack />',
58-
);
59-
}
60-
}, []);
61-
6251
return (
6352
<div className={styles.Grid} style={style}>
6453
{children}
@@ -71,5 +60,4 @@ export function formatAreas(areas?: string[]) {
7160
return `'${areas?.join(`' '`)}'`;
7261
}
7362

74-
// eslint-disable-next-line import/no-deprecated
7563
Grid.Cell = Cell;

polaris-react/src/components/Grid/components/Cell/Cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface CellProps {
3030
row?: Cell;
3131
children?: React.ReactNode;
3232
}
33-
/** @deprecated Use `Columns` instead or a combination of layout primitives (`Columns`, `Inline`, and `AlphaStack`) */
33+
3434
export function Cell({
3535
area: gridArea,
3636
column,

polaris-react/src/components/Grid/components/Cell/tests/Cell.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import {mountWithApp} from 'tests/utilities';
33

4-
// eslint-disable-next-line import/no-deprecated
54
import {Cell} from '../Cell';
65

76
describe('<Cell />', () => {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import {matchMedia, timer} from '@shopify/jest-dom-mocks';
33
import {mountWithApp} from 'tests/utilities';
44

5-
// eslint-disable-next-line import/no-deprecated
65
import {formatAreas, Grid} from '../Grid';
76

87
describe('<Grid />', () => {

polaris.shopify.com/content/components/deprecated/grid.md renamed to polaris.shopify.com/content/components/layout-and-structure/grid.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Grid
33
description: Create complex layouts based on [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/grid).
4-
category: Deprecated
4+
category: Layout and structure
55
keywords:
66
- one column
77
- two column
@@ -14,10 +14,8 @@ keywords:
1414
- full width containers
1515
- css grid
1616
status:
17-
value: Deprecated
18-
message: >-
19-
Grid was built prior to layout primitives like columns, inline, and alpha stack. Comparatively, grid is difficult to learn, document, and understand its usage in a codebase.
20-
The new layout primitives should be used in combination to achieve similar results to grid.
17+
value: Alpha
18+
message: This component is a work in progress and ready for exploratory usage, with breaking changes expected in minor version updates. Please use with caution. Learn more about our [component lifecycles](/getting-started/components-lifecycle).
2119
examples:
2220
- fileName: grid-two-column.tsx
2321
title: Two column

polaris.shopify.com/next.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@ const deprecated = [
191191
destination: '/components/deprecated/display-text',
192192
permanent: false,
193193
},
194-
{
195-
source: '/components/grid',
196-
destination: '/components/deprecated/grid',
197-
permanent: false,
198-
},
199194
{
200195
source: '/components/heading',
201196
destination: '/components/deprecated/heading',
@@ -395,6 +390,11 @@ const layoutAndStructure = [
395390
destination: '/components/layout-and-structure/form-layout',
396391
permanent: false,
397392
},
393+
{
394+
source: '/components/grid',
395+
destination: '/components/layout-and-structure/grid',
396+
permanent: false,
397+
},
398398
{
399399
source: '/components/inline',
400400
destination: '/components/layout-and-structure/inline',

0 commit comments

Comments
 (0)