|
1 | 1 | // The tree's typography now comes from @primer/react-brand NavList's own scale |
2 | 2 | // (level-1 section headers at size-200, leaves at size-100). This class is kept |
3 | | -// as the wrapper hook for `data-testid="sidebar"`; intentionally has no rules. |
| 3 | +// as the wrapper hook for `data-testid="sidebar"`. |
4 | 4 | .sidebar { |
| 5 | + // Brand's NavList draws the active accent bar only on nested leaves — its rule |
| 6 | + // explicitly excludes level-1 (`.item--leaf:not(.item--level-1) .link[aria-current]`), |
| 7 | + // so a top-level article like "Quickstart" gets only the subtle background pill |
| 8 | + // and no green bar. Restore the bar for active top-level leaves to match nested |
| 9 | + // items. Brand's classes are hashed, so match on the stable substrings. |
| 10 | + :global([class*="NavList__item--leaf"][class*="NavList__item--level-1"]) |
| 11 | + :global([class*="NavList__link"])[aria-current]:not( |
| 12 | + [aria-current="false"] |
| 13 | + )::before { |
| 14 | + content: ""; |
| 15 | + position: absolute; |
| 16 | + // Level-1 links are shorter (~24px) than nested leaves, so use a small inset |
| 17 | + // to keep the bar roughly the height of the background pill rather than the |
| 18 | + // larger inset brand applies to taller nested items. |
| 19 | + inset-block: var(--base-size-2); |
| 20 | + // Level-1 leaves have no inline padding, so pull the bar into the NavList's |
| 21 | + // own inline padding gutter to sit left of the label — matching where brand |
| 22 | + // places the level-1 indicator on expandable section toggles. |
| 23 | + inset-inline-start: calc(-1 * var(--base-size-8)); |
| 24 | + width: var(--base-size-4); |
| 25 | + border-radius: var(--base-size-2); |
| 26 | + background-color: var(--brand-NavList-activeIndicator-color); |
| 27 | + } |
5 | 28 | } |
0 commit comments