Skip to content

Commit 92ae058

Browse files
committed
Navigation v11 style updates
1 parent 4d72418 commit 92ae058

File tree

2 files changed

+77
-3
lines changed

2 files changed

+77
-3
lines changed

polaris-react/src/components/Navigation/Navigation.scss

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ $nav-max-width: 360px;
2020
-webkit-overflow-scrolling: touch;
2121
border-right: var(--p-border-width-1) solid var(--p-color-border-subdued);
2222

23+
#{$se23} & {
24+
background-color: var(--p-color-bg-subdued-active);
25+
border-right: 0;
26+
}
27+
2328
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
2429
@include safe-area-for(padding-bottom, 0, bottom);
2530

@@ -108,6 +113,10 @@ $disabled-fade: 0.6;
108113
.Item,
109114
.ItemInnerWrapper {
110115
border-radius: var(--p-border-radius-1);
116+
117+
#{$se23} & {
118+
border-radius: var(--p-border-radius-2);
119+
}
111120
}
112121

113122
.Item-selected {
@@ -127,6 +136,12 @@ $disabled-fade: 0.6;
127136
border-bottom-right-radius: var(--p-border-radius-1);
128137
}
129138

139+
#{$se23} & {
140+
&::before {
141+
display: none;
142+
}
143+
}
144+
130145
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
131146
@include focus-ring;
132147

@@ -147,6 +162,10 @@ $disabled-fade: 0.6;
147162
@include no-focus-ring;
148163
color: var(--p-color-text-primary);
149164
background-color: var(--p-color-bg-app-active);
165+
166+
#{$se23} & {
167+
background-color: var(--p-color-bg-strong);
168+
}
150169
}
151170

152171
@media #{$p-breakpoints-md-up} {
@@ -197,6 +216,10 @@ $disabled-fade: 0.6;
197216
&:not(:first-child) {
198217
.ItemInnerWrapper {
199218
border-top: var(--p-border-width-1) solid var(--p-color-bg-app);
219+
220+
#{$se23} & {
221+
border-top: 0;
222+
}
200223
}
201224
}
202225
}
@@ -238,11 +261,19 @@ $disabled-fade: 0.6;
238261
margin-top: calc(var(--p-space-2) + var(--p-space-05));
239262
margin-bottom: calc(var(--p-space-2) + var(--p-space-05));
240263

264+
#{$se23} & {
265+
font-size: var(--p-font-size-100);
266+
}
267+
241268
@media #{$p-breakpoints-md-up} {
242269
font-size: var(--p-font-size-100);
243270
line-height: var(--p-font-line-height-2);
244271
margin-top: var(--p-space-1);
245272
margin-bottom: var(--p-space-1);
273+
274+
#{$se23} & {
275+
font-size: var(--p-font-experimental-size-80);
276+
}
246277
}
247278
}
248279

@@ -392,13 +423,25 @@ $disabled-fade: 0.6;
392423
.Item {
393424
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
394425
font-size: 15px;
395-
font-weight: var(--p-font-weight-medium);
396426
line-height: nav(item-line-height);
397427
color: var(--p-color-text-subdued);
398428
padding-left: calc(var(--p-space-8) + var(--p-space-3));
399429

430+
#{$se23} & {
431+
font-weight: var(--p-font-weight-regular);
432+
433+
// stylelint-disable-next-line selector-max-combinators -- will no longer be an issue after removing se23
434+
&:is(:hover, :focus-visible) {
435+
background: var(--p-color-experimental-bg-transparent-hover);
436+
}
437+
}
438+
400439
&:hover {
401440
color: var(--p-color-text-subdued);
441+
442+
#{$se23} & {
443+
color: var(--p-color-text);
444+
}
402445
}
403446

404447
&:focus-visible {
@@ -412,6 +455,10 @@ $disabled-fade: 0.6;
412455
&:active:hover {
413456
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
414457
@include no-focus-ring;
458+
459+
#{$se23} & {
460+
background: var(--p-color-experimental-bg-transparent-active);
461+
}
415462
}
416463

417464
&:active {
@@ -429,13 +476,33 @@ $disabled-fade: 0.6;
429476
margin-top: var(--p-space-1);
430477
margin-bottom: var(--p-space-1);
431478
line-height: var(--p-space-5);
479+
480+
#{$se23} & {
481+
font-weight: var(--p-font-weight-regular);
482+
}
483+
}
484+
485+
#{$se23} & {
486+
// stylelint-disable-next-line selector-max-combinators -- will no longer be an issue after removing se23
487+
.ItemInnerWrapper-selected {
488+
background-color: var(--p-color-experimental-bg-transparent-active);
489+
}
432490
}
433491

434492
.Item-selected {
435493
color: var(--p-color-text-primary);
436494
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
437495
@include focus-ring;
438496

497+
#{$se23} & {
498+
color: var(--p-color-text);
499+
500+
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-compound-selectors -- necessary to override the specificity of the Text class
501+
.Text {
502+
font-weight: var(--p-font-weight-medium);
503+
}
504+
}
505+
439506
&:hover {
440507
color: var(--p-color-text-primary-hover);
441508
}

polaris-react/src/components/Navigation/components/Item/Item.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {MouseEvent, ReactNode} from 'react';
33

44
import {useIsomorphicLayoutEffect} from '../../../../utilities/use-isomorphic-layout-effect';
55
import {classNames} from '../../../../utilities/css';
6+
import {useFeatures} from '../../../../utilities/features';
67
import {NavigationContext} from '../../context';
78
import {Badge} from '../../../Badge';
89
import {Icon} from '../../../Icon';
@@ -107,6 +108,7 @@ export function Item({
107108
const {location, onNavigationDismiss} = useContext(NavigationContext);
108109
const navTextRef = useRef<HTMLSpanElement>(null);
109110
const [isTruncated, setIsTruncated] = useState(false);
111+
const {polarisSummerEditions2023} = useFeatures();
110112

111113
useEffect(() => {
112114
if (!isNavigationCollapsed && expanded) {
@@ -284,7 +286,9 @@ export function Item({
284286
const itemClassName = classNames(
285287
styles.Item,
286288
disabled && styles['Item-disabled'],
287-
selected && canBeActive && styles['Item-selected'],
289+
polarisSummerEditions2023
290+
? (selected || childIsActive) && styles['Item-selected']
291+
: selected && canBeActive && styles['Item-selected'],
288292
showExpanded && styles.subNavigationActive,
289293
childIsActive && styles['Item-child-active'],
290294
);
@@ -376,7 +380,10 @@ export function Item({
376380
<div
377381
className={classNames(
378382
styles.ItemInnerWrapper,
379-
selected && canBeActive && styles['ItemInnerWrapper-selected'],
383+
polarisSummerEditions2023
384+
? (selected || childIsActive) &&
385+
styles['ItemInnerWrapper-selected']
386+
: selected && canBeActive && styles['ItemInnerWrapper-selected'],
380387
displayActionsOnHover &&
381388
styles['ItemInnerWrapper-display-actions-on-hover'],
382389
disabled && styles.ItemInnerDisabled,

0 commit comments

Comments
 (0)