-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Navigation] Fix icon filter colors #4664
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,7 @@ Use to present a navigation menu in the [frame](https://polaris.shopify.com/comp | |
| <Navigation.Section | ||
| items={[ | ||
| { | ||
| url: '/path/to/place', | ||
| url: '/', | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We always have one active items in the nav within the admin. This change reflects that int he basic example |
||
| label: 'Home', | ||
| icon: HomeMajor, | ||
| }, | ||
|
|
@@ -202,7 +202,7 @@ Use to present a secondary action, related to a section and to title the section | |
| <Navigation.Section | ||
| items={[ | ||
| { | ||
| url: '/', | ||
| url: '/path/to/place', | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We had two active items in this example which should never happen. Undoing this one since the example is for selected secondary, which is below |
||
| label: 'Home', | ||
| icon: HomeMajor, | ||
| }, | ||
|
|
@@ -495,6 +495,11 @@ This example showcases the many elements that can compose a navigation, especial | |
| label: 'Icon as img', | ||
| icon: '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.791 2.253l-.597 3.583A1 1 0 0 0 2.18 7h.893a1.5 1.5 0 0 0 1.342-.83L5 5l.585 1.17A1.5 1.5 0 0 0 6.927 7h1.146a1.5 1.5 0 0 0 1.342-.83L10 5l.585 1.17a1.5 1.5 0 0 0 1.342.83h1.146a1.5 1.5 0 0 0 1.342-.83L15 5l.585 1.17a1.5 1.5 0 0 0 1.342.83h.893a1 1 0 0 0 .986-1.164l-.597-3.583A1.5 1.5 0 0 0 16.729 1H3.271a1.5 1.5 0 0 0-1.48 1.253zM4 18.5A1.5 1.5 0 0 1 5.5 17H8v-3h4v3h2.5a1.5 1.5 0 0 1 1.5 1.5v.5H4v-.5z"></path><path d="M2 9h2v4h12V9h2v4.5a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 2 13.5V9z"></path></svg>', | ||
| }, | ||
| { | ||
| url: '/', | ||
| label: 'Icon as img – Active', | ||
| icon: '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.791 2.253l-.597 3.583A1 1 0 0 0 2.18 7h.893a1.5 1.5 0 0 0 1.342-.83L5 5l.585 1.17A1.5 1.5 0 0 0 6.927 7h1.146a1.5 1.5 0 0 0 1.342-.83L10 5l.585 1.17a1.5 1.5 0 0 0 1.342.83h1.146a1.5 1.5 0 0 0 1.342-.83L15 5l.585 1.17a1.5 1.5 0 0 0 1.342.83h.893a1 1 0 0 0 .986-1.164l-.597-3.583A1.5 1.5 0 0 0 16.729 1H3.271a1.5 1.5 0 0 0-1.48 1.253zM4 18.5A1.5 1.5 0 0 1 5.5 17H8v-3h4v3h2.5a1.5 1.5 0 0 1 1.5 1.5v.5H4v-.5z"></path><path d="M2 9h2v4h12V9h2v4.5a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 2 13.5V9z"></path></svg>', | ||
| }, | ||
| { | ||
| url: '/path/to/place', | ||
| label: 'Other secondary action', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,10 +80,16 @@ $nav-animation-variables: ( | |
| // hardcoding this variable for now because we need to rip out all instances | ||
| // of filter() eventually but can't for this one right now. The value is the | ||
| // equivalent value for filter('icon'). | ||
| --p-icon-filter: brightness(0) saturate(100%) invert(36%) sepia(13%) | ||
| --p-filter-icon: brightness(0) saturate(100%) invert(36%) sepia(13%) | ||
| saturate(137%) hue-rotate(169deg) brightness(95%) contrast(87%); | ||
|
|
||
| @include recolor-icon(var(--p-icon), transparent, var(--p-icon-filter)); | ||
| --p-filter-icon-action-primary: brightness(0) saturate(100%) invert(20%) | ||
| sepia(59%) saturate(5557%) hue-rotate(162deg) brightness(95%) contrast(101%); | ||
| --p-filter-icon-on-interactive: brightness(0) saturate(100%) invert(100%); | ||
|
Comment on lines
+83
to
+87
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. Thanks @kyledurand. |
||
|
|
||
| @include recolor-icon( | ||
| $fill-color: var(--p-icon), | ||
| $filter-color: var(--p-filter-icon) | ||
| ); | ||
| flex-shrink: 0; | ||
| align-self: flex-start; | ||
| width: nav(icon-size); | ||
|
|
@@ -99,7 +105,10 @@ $nav-animation-variables: ( | |
|
|
||
| .Item:hover &, | ||
| .Item.keyFocused & { | ||
| @include recolor-icon(var(--p-icon), transparent, var(--p-icon)); | ||
| @include recolor-icon( | ||
| $fill-color: var(--p-icon), | ||
| $filter-color: var(--p-filter-icon) | ||
| ); | ||
| } | ||
|
|
||
| .Item-selected &, | ||
|
|
@@ -108,9 +117,8 @@ $nav-animation-variables: ( | |
| .subNavigationActive:hover &, | ||
| .Item-selected.keyFocused & { | ||
| @include recolor-icon( | ||
| var(--p-action-primary), | ||
| transparent, | ||
| var(--p-icon-on-interactive) | ||
| $fill-color: var(--p-action-primary), | ||
| $filter-color: var(--p-filter-icon-action-primary) | ||
| ); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching to named vars throughout this PR for clarity. Should make things slightly easier to figure out what's going on when we remove
recolor-icon()