Skip to content

Commit

Permalink
Merge 0d726b7 into 1f9ca0e
Browse files Browse the repository at this point in the history
  • Loading branch information
JelloBagel authored Dec 11, 2024
2 parents 1f9ca0e + 0d726b7 commit 820d278
Show file tree
Hide file tree
Showing 14 changed files with 283 additions and 121 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-planes-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Convert SideNav component to CSS Modules behind team feature flag
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 114 additions & 0 deletions packages/react/src/SideNav.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
.SideNav {
background-color: var(--bgColor-muted);
}

.SideNavBordered {
border-color: var(--borderColor-default);
border-style: solid;
border-width: var(--borderWidth-thin);
border-radius: var(--borderRadius-medium);

/* Remove duplicate borders from nested SideNavs */
& > & {
border-right: 0;
border-bottom: 0;
border-left: 0;
}
}

.SideNavLink {
position: relative;
display: block;
width: 100%;
/* stylelint-disable-next-line primer/typography */
font-size: 14px;
text-align: left;
text-decoration: none;

& > .SideNav {
border-bottom: none;
}

.SideNav.SideNavVariant-normal > & {
padding: var(--base-size-16);
color: var(--fgColor-default);
border: 0;
border-top: var(--borderWidth-thin) solid var(--borderColor-muted);

&:first-child {
border-top: 0;
border-top-left-radius: var(--borderRadius-medium);
border-top-right-radius: var(--borderRadius-medium);
}

&:last-child {
border-bottom-right-radius: var(--borderRadius-medium);
border-bottom-left-radius: var(--borderRadius-medium);
}

/* Bar on the left */
&::before {
position: absolute;
top: 0;
bottom: 0;
left: 0;
z-index: 1;
width: 3px;
pointer-events: none;
content: '';
}

&:hover {
text-decoration: none;
background-color: var(--bgColor-neutral-muted);
}

&:focus {
z-index: 1;
text-decoration: none;
background-color: var(--bgColor-neutral-muted);
outline: solid 2px var(--fgColor-accent);
}

&[aria-current='page'],
&[aria-selected='true'] {
background-color: var(--bgColor-default);

/* Bar on the left */
/* stylelint-disable-next-line selector-max-specificity */
&::before {
/* stylelint-disable-next-line primer/colors */
background-color: #fd8c73;
}
}
}

.SideNav.SideNavVariant-lightweight > & {
padding: var(--base-size-4) 0;
color: var(--fgColor-accent);

&:hover {
color: var(--fgColor-default);
text-decoration: none;
}

&:focus {
z-index: 1;
color: var(--fgColor-default);
text-decoration: none;
outline: solid 1px var(--fgColor-accent);
}

&[aria-current='page'],
&[aria-selected='true'] {
font-weight: var(--base-text-weight-medium);
color: var(--fgColor-default);
}
}
}

.SideNavLinkFull {
display: flex;
align-items: center;
justify-content: space-between;
}
Loading

0 comments on commit 820d278

Please sign in to comment.