Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slimy-years-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': minor
---

Updated `OptionList` to use new layout primitives
15 changes: 0 additions & 15 deletions polaris-react/src/components/OptionList/OptionList.scss

This file was deleted.

32 changes: 19 additions & 13 deletions polaris-react/src/components/OptionList/OptionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {isSection} from '../../utilities/options';
import {arraysAreEqual} from '../../utilities/arrays';
import {useUniqueId} from '../../utilities/unique-id';
import {useDeepEffect} from '../../utilities/use-deep-effect';
import {Box} from '../Box';
import {Box, BoxProps} from '../Box';
import {Text} from '../Text';
import {Bleed} from '../Bleed';

import {Option} from './components';
import styles from './OptionList.scss';

type Alignment = 'top' | 'center' | 'bottom';

Expand Down Expand Up @@ -130,24 +130,30 @@ export function OptionList({
});

return (
<li key={title || `noTitle-${sectionIndex}`}>
<Box
key={title || `noTitle-${sectionIndex}`}
as="li"
paddingBlockStart={isFirstOption ? undefined : '2'}
>
{titleMarkup}
<ul
className={styles.Options}
id={`${id}-${sectionIndex}`}
role={role}
>
{optionsMarkup}
</ul>
</li>
<Bleed marginBlockStart={title ? undefined : '05'} marginInline="0">
<Box
as="ul"
id={`${id}-${sectionIndex}`}
role={role as BoxProps['role']}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the uglier version with all the comments is better for visibility. But we can ship either one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree the one with all the comments was better for visibility to know to remove it but I'm okay with either version!

>
{optionsMarkup}
</Box>
</Bleed>
</Box>
);
})
: null;

return (
<ul className={styles.OptionList} role={role}>
<Box as="ul" role={role as BoxProps['role']} padding="2">
{optionsMarkup}
</ul>
</Box>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ $control-vertical-adjustment: 2px;
.Media {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include recolor-icon(var(--p-icon));
padding: 0 var(--p-space-2);
}

.verticalAlignTop {
Expand Down