Skip to content

Commit 8223135

Browse files
authored
Fixed delayed appearance of heading separator in SubNav (#866)
1 parent 4bac386 commit 8223135

File tree

4 files changed

+36
-22
lines changed

4 files changed

+36
-22
lines changed

.changeset/long-nails-rest.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Fixed delayed appearance of heading separator in `SubNav`.

packages/react/src/SubNav/SubNav.module.css

+4
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@
278278
z-index: 9998;
279279
}
280280

281+
.SubNav__heading-separator:not(.SubNav__heading-separator--has-adjacent-label) {
282+
display: none;
283+
}
284+
281285
.SubNav__links-overlay {
282286
position: relative;
283287
display: flex;

packages/react/src/SubNav/SubNav.module.css.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ declare const styles: {
2424
readonly "SubNav--open": string;
2525
readonly "fade-in": string;
2626
readonly "SubNav__header-container": string;
27+
readonly "SubNav__heading-separator--has-adjacent-label": string;
2728
readonly "SubNav__links-overlay--open": string;
2829
readonly "SubNav__link--has-sub-menu": string;
2930
readonly "SubNav__overlay-toggle": string;

packages/react/src/SubNav/SubNav.tsx

+26-22
Original file line numberDiff line numberDiff line change
@@ -239,28 +239,32 @@ const _SubNavRoot = memo(({id, children, className, 'data-testid': testId, fullW
239239
<div ref={rootRef} className={styles['SubNav--header-container-outer']}>
240240
<div className={styles['SubNav__header-container']}>
241241
{HeadingChild && <div className={styles['SubNav__heading-container']}>{HeadingChild}</div>}
242-
{(activeLinklabel || isLarge) && (
243-
<span role="separator" className={styles['SubNav__heading-separator']} aria-hidden>
244-
<svg
245-
xmlns="http://www.w3.org/2000/svg"
246-
width="8"
247-
height="16"
248-
viewBox="0 0 8 16"
249-
fill="none"
250-
aria-hidden
251-
>
252-
<g clipPath="url(#clip0_50_1307)">
253-
<path d="M0 15.2992L5.472 0.701172H7.632L2.16 15.2992H0Z" fill="currentColor" />
254-
</g>
255-
<defs>
256-
<clipPath id="clip0_50_1307">
257-
<rect width="7.632" height="14.598" transform="translate(0 0.701172)" />
258-
</clipPath>
259-
</defs>
260-
</svg>
261-
</span>
262-
)}
263-
242+
<span
243+
role="separator"
244+
className={clsx(
245+
styles['SubNav__heading-separator'],
246+
activeLinklabel && styles['SubNav__heading-separator--has-adjacent-label'],
247+
)}
248+
aria-hidden
249+
>
250+
<svg
251+
xmlns="http://www.w3.org/2000/svg"
252+
width="8"
253+
height="16"
254+
viewBox="0 0 8 16"
255+
fill="none"
256+
aria-hidden
257+
>
258+
<g clipPath="url(#clip0_50_1307)">
259+
<path d="M0 15.2992L5.472 0.701172H7.632L2.16 15.2992H0Z" fill="currentColor" />
260+
</g>
261+
<defs>
262+
<clipPath id="clip0_50_1307">
263+
<rect width="7.632" height="14.598" transform="translate(0 0.701172)" />
264+
</clipPath>
265+
</defs>
266+
</svg>
267+
</span>
264268
{!isLarge && (
265269
<button
266270
className={clsx(

0 commit comments

Comments
 (0)