Skip to content

Commit 4fb2bdc

Browse files
avelinelaurkim
andauthored
[Layout] AlphaStack remove fullwidth prop (#8582)
### WHY are these changes introduced? #8530 removed default alignment so that the default is now `stretch` which renders all children full width. This makes the existing `fullWidth` prop unnecessary.`fullWidth` collides with/override `align="start | center | end"` because of specificity and so they can't be used together. It is also causing confusion (#8579), so I think we should remove it. ### WHAT is this pull request doing? - Removes the `fullWidth` prop from `AlphaStack` - Sets default `--pc-stack-align: initial;` so that nested Stacks don't inherit align from parent. To do: - [x] Remove `fullWidth` in style guide --------- Co-authored-by: Lo Kim <[email protected]>
1 parent 7d1c4f1 commit 4fb2bdc

File tree

17 files changed

+32
-52
lines changed

17 files changed

+32
-52
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Removed `fullWidth` prop from `AlphaStack`

polaris-react/src/components/AlphaStack/AlphaStack.scss

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
.AlphaStack {
44
// stylelint-disable -- Polaris component custom properties
5+
--pc-stack-align: initial;
56
--pc-stack-gap-xs: 0;
67
--pc-stack-gap-sm: var(--pc-stack-gap-xs);
78
--pc-stack-gap-md: var(--pc-stack-gap-sm);
@@ -51,10 +52,3 @@
5152
margin: 0;
5253
padding: 0;
5354
}
54-
55-
.fullWidth {
56-
> * {
57-
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
58-
width: 100%;
59-
}
60-
}

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,3 @@ export function WithAlignEnd() {
101101
</AlphaStack>
102102
);
103103
}
104-
105-
export function WithFullWidthChildren() {
106-
return (
107-
<AlphaStack gap="4" fullWidth>
108-
<Box background="surface" padding="1">
109-
01
110-
</Box>
111-
<Box background="surface" padding="1">
112-
02
113-
</Box>
114-
<Box background="surface" padding="1">
115-
03
116-
</Box>
117-
</AlphaStack>
118-
);
119-
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ export interface AlphaStackProps extends React.AriaAttributes {
2424
as?: Element;
2525
/** Horizontal alignment of children */
2626
align?: Align;
27-
/** Toggle children to be full width
28-
* @default false
29-
*/
30-
fullWidth?: boolean;
3127
/** The spacing between children */
3228
gap?: Gap;
3329
/** HTML id attribute */
@@ -42,15 +38,13 @@ export const AlphaStack = ({
4238
as = 'div',
4339
children,
4440
align,
45-
fullWidth = false,
4641
gap,
4742
id,
4843
reverseOrder = false,
4944
...restProps
5045
}: AlphaStackProps) => {
5146
const className = classNames(
5247
styles.AlphaStack,
53-
fullWidth && styles.fullWidth,
5448
as === 'ul' && styles.listReset,
5549
as === 'fieldset' && styles.fieldsetReset,
5650
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export function InACard() {
193193
export function WithEndJustifiedContent() {
194194
return (
195195
<Banner status="critical">
196-
<AlphaStack gap="1" fullWidth>
196+
<AlphaStack gap="1">
197197
<Inline gap="4" align="space-between">
198198
<Text variant="headingMd" fontWeight="semibold" as="h3">
199199
Deployment failed in 5min

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,11 @@ export function ChoiceList({
135135
<AlphaStack
136136
as="fieldset"
137137
gap={{xs: '4', md: '0'}}
138-
fullWidth
139138
aria-invalid={error != null}
140139
id={finalName}
141140
>
142141
{titleMarkup}
143-
<AlphaStack as="ul" gap={{xs: '4', md: '0'}} fullWidth>
142+
<AlphaStack as="ul" gap={{xs: '4', md: '0'}}>
144143
{choicesMarkup}
145144
</AlphaStack>
146145
{errorMarkup}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function Default() {
1212

1313
export function WithBorderStyles() {
1414
return (
15-
<AlphaStack gap="5" fullWidth>
15+
<AlphaStack gap="5">
1616
<Text as="h1" variant="headingXs">
1717
Base
1818
</Text>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function WithImageFileUpload() {
123123
);
124124

125125
return (
126-
<AlphaStack gap="4" fullWidth>
126+
<AlphaStack gap="4">
127127
{errorMessage}
128128
<DropZone accept="image/*" type="image" onDrop={handleDrop}>
129129
{uploadedFiles}
@@ -284,7 +284,7 @@ export function AcceptsOnlySVGFiles() {
284284
);
285285

286286
return (
287-
<AlphaStack gap="4" fullWidth>
287+
<AlphaStack gap="4">
288288
{errorMessage}
289289
<DropZone
290290
accept="image/svg+xml"

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ export function SkeletonPage({
6363
) : null;
6464

6565
return (
66-
<AlphaStack gap="4" align="center" fullWidth>
66+
<AlphaStack gap="4" align="center">
6767
<Box
68+
width="100%"
6869
padding="0"
6970
paddingInlineStart={{sm: '6'}}
7071
paddingInlineEnd={{sm: '6'}}
@@ -78,12 +79,13 @@ export function SkeletonPage({
7879
maxWidth: 'none',
7980
})}
8081
>
81-
<AlphaStack fullWidth>
82+
<AlphaStack>
8283
<Box
8384
paddingBlockStart={{xs: '4', md: '5'}}
8485
paddingBlockEnd={{xs: '4', md: '5'}}
8586
paddingInlineStart={{xs: '4', sm: '0'}}
8687
paddingInlineEnd={{xs: '4', sm: '0'}}
88+
width="100%"
8789
>
8890
{breadcrumbMarkup}
8991
<Inline gap="4" align="space-between" blockAlign="center">
@@ -93,7 +95,9 @@ export function SkeletonPage({
9395
{primaryActionMarkup}
9496
</Inline>
9597
</Box>
96-
<Box paddingBlockEnd="2">{children}</Box>
98+
<Box paddingBlockEnd="2" width="100%">
99+
{children}
100+
</Box>
97101
</AlphaStack>
98102
</Box>
99103
</AlphaStack>

polaris.shopify.com/content/patterns/app-settings-layout/variants/default.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ This pattern uses the [`AlphaStack`](/components/layout-and-structure/alpha-stac
6262
</AlphaStack>
6363
</Box>
6464
<AlphaCard roundedAbove="sm">
65-
<AlphaStack gap="4" fullWidth>
65+
<AlphaStack gap="4">
6666
<TextField label="Interjamb style" />
6767
<TextField label="Interjamb ratio" />
6868
</AlphaStack>
@@ -84,7 +84,7 @@ This pattern uses the [`AlphaStack`](/components/layout-and-structure/alpha-stac
8484
</AlphaStack>
8585
</Box>
8686
<AlphaCard roundedAbove="sm">
87-
<AlphaStack gap="4" fullWidth>
87+
<AlphaStack gap="4">
8888
<TextField label="Horizontal" />
8989
<TextField label="Interjamb ratio" />
9090
</AlphaStack>

0 commit comments

Comments
 (0)