Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1ad488a

Browse files
committedMar 6, 2024··
chore: update Optionlist layout
1 parent b4ef876 commit 1ad488a

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed
 

‎polaris-react/src/components/OptionList/components/Option/Option.module.scss

+1-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $control-vertical-adjustment: 2px;
3232

3333
display: flex;
3434
flex-wrap: nowrap;
35-
justify-content: space-between;
35+
gap: var(--p-space-200);
3636

3737
// stylelint-disable-next-line selector-max-specificity -- required for focus-visible support
3838
&.focused:focus-visible:not(:active) {
@@ -140,14 +140,6 @@ $control-vertical-adjustment: 2px;
140140
align-items: flex-end;
141141
}
142142

143-
.Icon {
144-
margin-left: var(--p-space-200);
145-
146-
svg {
147-
fill: var(--p-color-icon-brand);
148-
}
149-
}
150-
151143
.Checkbox {
152144
box-sizing: border-box;
153145
display: flex;

‎polaris-react/src/components/OptionList/components/Option/Option.tsx

+15-14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {classNames, variationName} from '../../../../utilities/css';
1111
import type {InlineStackProps} from '../../../InlineStack';
1212
import {InlineStack} from '../../../InlineStack';
1313
import {Checkbox as PolarisCheckbox} from '../../../Checkbox';
14+
import {Box} from '../../../Box';
1415

1516
import styles from './Option.module.scss';
1617

@@ -125,20 +126,20 @@ export function Option({
125126
onBlur={toggleFocused}
126127
aria-pressed={active || select}
127128
>
128-
<>
129-
<InlineStack
130-
wrap={false}
131-
blockAlign={verticalAlignToBlockAlign(verticalAlign)}
132-
>
133-
{mediaMarkup}
134-
{label}
135-
</InlineStack>
136-
{(select || active) && (
137-
<span className={styles.Icon}>
138-
<Icon source={CheckIcon} />
139-
</span>
140-
)}
141-
</>
129+
{select || active ? (
130+
<span className={styles.Icon}>
131+
<Icon source={CheckIcon} tone="base" />
132+
</span>
133+
) : (
134+
<Box width="20px" />
135+
)}
136+
<InlineStack
137+
wrap={false}
138+
blockAlign={verticalAlignToBlockAlign(verticalAlign)}
139+
>
140+
{mediaMarkup}
141+
{label}
142+
</InlineStack>
142143
</button>
143144
);
144145

0 commit comments

Comments
 (0)
Please sign in to comment.