Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Choice] Consolidate se23 logic and styles #10013

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
37 changes: 8 additions & 29 deletions polaris-react/src/components/Choice/Choice.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
);
@include responsive-props('choice', 'fill', '--pc-choice-fill');
display: inline-flex;
align-items: center;
justify-content: flex-start;
cursor: pointer;
padding-block-start: calc(
Expand Down Expand Up @@ -78,10 +79,6 @@
var(--pc-choice-bleed-block-start, var(--pc-choice-space-0)) +
var(--pc-choice-bleed-block-end, var(--pc-choice-space-0))
);

#{$se23} & {
align-items: center;
}
}

.labelHidden {
Expand Down Expand Up @@ -120,28 +117,18 @@
}

.disabled + .Descriptions {
#{$se23} & {
// the <Text/> component in the HelpText markup in Choice.tsx is set to `undefined` when the disabled prop is true
// Which tells it to inherit whatever color we specify here.
color: var(--p-color-text-disabled);
}
// the <Text/> component in the HelpText markup in Choice.tsx is set to `undefined` when the disabled prop is true
// Which tells it to inherit whatever color we specify here.
color: var(--p-color-text-disabled);
}

.Control {
// stylelint-disable-next-line -- Polaris component custom properties
--pc-choice-size: 20px;
#{$se23} & {
// stylelint-disable-next-line -- PSE23 temporary property overrides
--pc-choice-size: 18px;
}
--pc-choice-size: 18px;

@media #{$p-breakpoints-md-down} {
// stylelint-disable-next-line -- Polaris component custom properties
--pc-choice-size: 22px;
#{$se23} & {
// stylelint-disable-next-line -- PSE23 Polaris component custom properties
--pc-choice-size: 20px;
}
--pc-choice-size: 20px;
}
display: flex;
flex: 0 0 auto;
Expand All @@ -167,19 +154,11 @@

.Descriptions {
// stylelint-disable-next-line -- Polaris component custom properties
--pc-choice-size: 20px;
#{$se23} & {
// stylelint-disable-next-line -- PSE23 Polaris component custom properties
--pc-choice-size: 18px;
}
--pc-choice-size: 18px;

@media #{$p-breakpoints-md-down} {
// stylelint-disable-next-line -- Polaris component custom properties
--pc-choice-size: 22px;
#{$se23} {
// stylelint-disable-next-line -- PSE23 Polaris component custom properties
--pc-choice-size: 20px;
}
--pc-choice-size: 20px;
}
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
padding-left: calc(var(--p-space-2) + var(--pc-choice-size));
Expand Down
4 changes: 1 addition & 3 deletions polaris-react/src/components/Choice/Choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {ResponsiveProp} from '../../utilities/css';
import type {Error} from '../../types';
import {InlineError} from '../InlineError';
import {Text} from '../Text';
import {useFeatures} from '../../utilities/features';

import styles from './Choice.scss';

Expand Down Expand Up @@ -90,7 +89,6 @@ export function Choice({
bleedInlineStart,
bleedInlineEnd,
}: ChoiceProps) {
const {polarisSummerEditions2023} = useFeatures();
const className = classNames(
styles.Choice,
labelHidden && styles.labelHidden,
Expand Down Expand Up @@ -158,7 +156,7 @@ export function Choice({
as="span"
// `undefined` means color: inherit
// the nearest ancestor with a specified color is .Descriptions in Choice.scss
color={disabled && polarisSummerEditions2023 ? undefined : 'subdued'}
color={disabled ? undefined : 'subdued'}
>
{helpText}
</Text>
Expand Down