Skip to content

Conversation

@yurm04
Copy link
Contributor

@yurm04 yurm04 commented Nov 16, 2021

WHY are these changes introduced?

Follow up to #4636, there were a few color() functions that got left behind. Cleaning up the rest.

How to 🎩

Run storybook and check Chromatic for visual regressions

@yurm04 yurm04 requested review from alex-page and lgriffee November 16, 2021 23:18
// This is the only place this color is used.
// stylelint-disable-next-line color-no-hex
$item-selected-background: rgba(color('indigo'), 0.12);
$item-selected-background: rgba(var(--p-background-selected), 0.12);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this isn't actually used anywhere but assuming this should be removed in a followup PR

Copy link
Member

Choose a reason for hiding this comment

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

Happy to remove it now 👍

Copy link
Member

Choose a reason for hiding this comment

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

Only files referenced by src/styles/_public-api.scss are part of the public API. I've not checked but I suspect this file is only used by the styles for specific components (e.g. Navigation/Navigation.scss), and is never referenced by _public-api.scss. If that is the case then we are free to delete this in the main branch without any backwards compatability concerns and you are free to nuke it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

confirmed that this is not referenced in the _public-api.scss file (and isn't even used by Navigation.scss or elsewhere. Removing this line entirely.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 16, 2021

size-limit report

Path Size
cjs 166.18 KB (0%)
esm 96.75 KB (0%)
esnext 143.3 KB (+0.01% 🔺)
css 34.28 KB (0%)


@mixin button-outline-disabled($outline-color) {
background: transparent;
// border-color: rgba($outline-color, 0.25);
Copy link
Member

Choose a reason for hiding this comment

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

We should probably get this line too!

// Because the outline border color has a 40% opacity, the left border appears darker than the rest of the borders because they are layered over one another. Reducing the opacity to zero for the connected disclosure when not focused gives us the expected border color.
&.outline:not(:focus) {
border-left-color: rgba(color('ink', 'lighter'), 0);
border-left-color: rgba(var(--p-border-disabled), 0);
Copy link
Member

Choose a reason for hiding this comment

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

I believe rgba is a sass function, I don't think it will have the desired effect when you pass in a css variable, as the color won't be resolved till runtime

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 didn't know this! Thanks @BPScott

@alex-page what's the best way forward on this? hard code the color? leave for now and create a new issue? is rgba() going to be removed eventually as well?

Copy link
Member

Choose a reason for hiding this comment

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

Lets hard code the color to unblock this PR. It will be a failure on polaris-coverage so we won't miss it.

// This is the only place this color is used.
// stylelint-disable-next-line color-no-hex
$item-selected-background: rgba(color('indigo'), 0.12);
$item-selected-background: rgba(var(--p-background-selected), 0.12);
Copy link
Member

Choose a reason for hiding this comment

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

Only files referenced by src/styles/_public-api.scss are part of the public API. I've not checked but I suspect this file is only used by the styles for specific components (e.g. Navigation/Navigation.scss), and is never referenced by _public-api.scss. If that is the case then we are free to delete this in the main branch without any backwards compatability concerns and you are free to nuke it now.

@yurm04 yurm04 force-pushed the follow-up-color-filter branch from f53f6e2 to 1cd6488 Compare November 22, 2021 17:59
@yurm04 yurm04 requested review from BPScott and alex-page November 22, 2021 19:08
Copy link
Member

@BPScott BPScott left a comment

Choose a reason for hiding this comment

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

Seems we never use those arguments on button-outline, and button-outline-disabled. Perhaps we should just stop passing them in entirely?

We can't remove the parameter from the function on main as that would be a breaking change, but we could stop passing any value in when we call it


&.disabled {
@include button-outline-disabled(color('ink', 'lighter'));
@include button-outline-disabled(var(--p-border-disabled));
Copy link
Member

Choose a reason for hiding this comment

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

The $outline-color parameter doesn't seem to be used anymore. https://github.com/Shopify/polaris-react/blob/main/src/styles/shared/_buttons.scss#L198-L205

Perhaps we can just remove passing in the argument entirely: @include button-outline-disabled()

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively this seems to be the only place this mixin is used - perhaps we just inline it here as all it does is background: transparent; box-shadow: none;

}

.outline {
@include button-outline(color('ink', 'lighter'));
Copy link
Member

Choose a reason for hiding this comment

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

The $outline-color parameter doesn't seem to be used anymore. https://github.com/Shopify/polaris-react/blob/main/src/styles/shared/_buttons.scss#L118

Perhaps we can just remove passing in the argument entirely: @include button-outline()


.destructive.outline {
@include button-outline(color('red'));
@include button-outline(var(--p-border-critical));
Copy link
Member

Choose a reason for hiding this comment

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

As above

@yurm04 yurm04 force-pushed the follow-up-color-filter branch from 71dfa0e to 9c92aec Compare November 22, 2021 21:25
@yurm04 yurm04 requested a review from BPScott November 22, 2021 21:25
Co-authored-by: Alex Page <hi@alexpage.dev>
@yurm04 yurm04 added the 🤖Skip Changelog Causes CI to ignore changelog update check. label Nov 22, 2021
@yurm04 yurm04 merged commit 87ddd77 into main Nov 22, 2021
@yurm04 yurm04 deleted the follow-up-color-filter branch November 22, 2021 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖Skip Changelog Causes CI to ignore changelog update check.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants