Skip to content

Commit 49ed527

Browse files
author
Yuraima Estevez
authored
Add reverseOrder prop to AlphaStack for flex-direction: column-reverse (#7842)
<!-- ☝️How to write a good PR title: - Prefix it with [ComponentName] (if applicable), for example: [Button] - Start with a verb, for example: Add, Delete, Improve, Fix… - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ### WHY are these changes introduced? We need `flex-direction: column-reverse` in order to rebuild `EmptyState`. Adding this to `AlphaStack` Supports #7809 <!-- Context about the problem that’s being addressed. --> ### WHAT is this pull request doing? <!-- Summary of the changes committed. Before / after screenshots are appreciated for UI changes. Make sure to include alt text that describes the screenshot. If you include an animated gif showing your change, wrapping it in a details tag is recommended. Gifs usually autoplay, which can cause accessibility issues for people reviewing your PR: <details> <summary>Summary of your gif(s)</summary> <img src="..." alt="Description of what the gif shows"> </details> --> <!-- ℹ️ Delete the following for small / trivial changes --> ### How to 🎩 🖥 [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) <!-- Give as much information as needed to experiment with the component in the playground. --> <details> <summary>Copy-paste this code in <code>playground/Playground.tsx</code>:</summary> ```jsx import React from 'react'; import {Page} from '../src'; export function Playground() { return ( <Page title="Playground"> {/* Add the code you want to test in here */} </Page> ); } ``` </details> ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] 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 0c8fd7f commit 49ed527

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

.changeset/grumpy-bats-live.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+
Add flex-direction: column-reverse to AlphaStack

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
--pc-stack-gap-xl: var(--pc-stack-gap-lg);
1414
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
1515
display: flex;
16-
flex-direction: column;
16+
// stylelint-disable-next-line -- local component custom property is required for flex direction
17+
flex-direction: var(--pc-stack-order);
1718
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
1819
align-items: var(--pc-stack-align);
1920
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@@ -38,10 +39,6 @@
3839
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
3940
gap: var(--pc-stack-gap-xl);
4041
}
41-
42-
> * {
43-
max-width: 100%;
44-
}
4542
}
4643

4744
.listReset {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export interface AlphaStackProps extends React.AriaAttributes {
3636
gap?: Gap;
3737
/** HTML id attribute */
3838
id?: string;
39+
/** Toggle order of child items */
40+
reverseOrder?: boolean;
3941
}
4042

4143
export const AlphaStack = ({
@@ -45,6 +47,7 @@ export const AlphaStack = ({
4547
fullWidth = false,
4648
gap = '4',
4749
id,
50+
reverseOrder = false,
4851
...restProps
4952
}: AlphaStackProps) => {
5053
const className = classNames(
@@ -55,6 +58,7 @@ export const AlphaStack = ({
5558

5659
const style = {
5760
'--pc-stack-align': align ? `${align}` : '',
61+
'--pc-stack-order': reverseOrder ? 'column-reverse' : 'column',
5862
...getResponsiveProps('stack', 'gap', 'space', gap),
5963
} as React.CSSProperties;
6064

0 commit comments

Comments
 (0)