Skip to content

Commit 05fe1f6

Browse files
committed
chore: rename spacing to gap on List and DescriptionList
1 parent abeef7a commit 05fe1f6

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

.changeset/fast-suits-jog.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+
Changed `spacing` prop to `gap` on `List` and `DescriptionList`

documentation/guides/migrating-from-v11-to-v12.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,11 @@ Polaris v12.0.0 ([full release notes](https://github.com/Shopify/polaris/release
105105
`npx @shopify/polaris-migrator react-rename-component-prop <path> --componentName="Modal" --from="large" --to="size" --newValue="large"`
106106

107107
`npx @shopify/polaris-migrator react-rename-component-prop <path> --componentName="Modal" --from="fullScreen" --to="size" --newValue="fullScreen"`
108+
109+
**List**
110+
111+
`npx @shopify/polaris-migrator react-rename-component-prop <path> --componentName="List" --from="spacing" --to="gap"`
112+
113+
**DescriptionList**
114+
115+
`npx @shopify/polaris-migrator react-rename-component-prop <path> --componentName="DescriptionList" --from="spacing" --to="gap"`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function Default() {
3333
export function Tight() {
3434
return (
3535
<DescriptionList
36-
spacing="tight"
36+
gap="tight"
3737
items={[
3838
{
3939
term: 'Logistics',

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ export interface DescriptionListProps {
1616
/** Collection of items for list */
1717
items: Item[];
1818
/** Determines the spacing between list items */
19-
spacing?: 'tight' | 'loose';
19+
gap?: 'tight' | 'loose';
2020
}
2121

22-
export function DescriptionList({
23-
items,
24-
spacing = 'loose',
25-
}: DescriptionListProps) {
22+
export function DescriptionList({items, gap = 'loose'}: DescriptionListProps) {
2623
// There's no good key to give React so using the index is a last resport.
2724
// we can't use the term/description value as it may be a react component
2825
// which can't be stringified
@@ -43,7 +40,7 @@ export function DescriptionList({
4340

4441
const className = classNames(
4542
styles.DescriptionList,
46-
spacing === 'tight' && styles.spacingTight,
43+
gap === 'tight' && styles.spacingTight,
4744
);
4845

4946
return <dl className={className}>{terms}</dl>;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function Numbered() {
2828

2929
export function ExtraTight() {
3030
return (
31-
<List spacing="extraTight">
31+
<List gap="extraTight">
3232
<List.Item>Yellow shirt</List.Item>
3333
<List.Item>Red shirt</List.Item>
3434
<List.Item>Green shirt</List.Item>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface ListProps {
1414
* Determines the space between list items
1515
* @default 'loose'
1616
*/
17-
spacing?: Spacing;
17+
gap?: Spacing;
1818
/**
1919
* Type of list to display
2020
* @default 'bullet'
@@ -26,10 +26,10 @@ export interface ListProps {
2626

2727
export const List: React.FunctionComponent<ListProps> & {
2828
Item: typeof Item;
29-
} = function List({children, spacing = 'loose', type = 'bullet'}: ListProps) {
29+
} = function List({children, gap = 'loose', type = 'bullet'}: ListProps) {
3030
const className = classNames(
3131
styles.List,
32-
spacing && styles[variationName('spacing', spacing)],
32+
gap && styles[variationName('spacing', gap)],
3333
type && styles[variationName('type', type)],
3434
);
3535

polaris.shopify.com/pages/examples/list-extra-tight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
44

55
function ListExtraTightExample() {
66
return (
7-
<List spacing="extraTight">
7+
<List gap="extraTight">
88
<List.Item>Yellow shirt</List.Item>
99
<List.Item>Red shirt</List.Item>
1010
<List.Item>Green shirt</List.Item>

0 commit comments

Comments
 (0)