Skip to content

Commit

Permalink
Sidebar nav v-scroll - switcher static
Browse files Browse the repository at this point in the history
Added a nice little gradient overlay for the nav to scroll under too
  • Loading branch information
ewels committed Sep 27, 2024
1 parent 6e69fee commit 367b163
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ svg.excalidraw path[fill="#fff"] {
/* Custom styling for sidebar nav links */
.theme-doc-sidebar-container > div {
top: 74px;
overflow-y: auto;
}
nav.menu .menu__list .menu__link {
border-radius: 5px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.switcher {
position: relative;
margin: 8px 0 15px 0;
margin: 8px 0 0 0;
.button {
border-bottom-color: var(--color-brand-200) !important;
z-index: 10;
Expand Down
15 changes: 10 additions & 5 deletions src/theme/DocSidebar/Desktop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ type Props = {
const DesktopWrapper: React.FC<Props> = (props) => {
return (
<div className={styles.sidebar}>
<SearchBar />
<ProductSwitcher isDropdown={!!props.sidebar} />
{!!props.sidebar && <TOC {...props} />}
<hr />
<NavbarColorModeToggle className={styles.colorModeToggle} />
<div className={styles.sidebarHeader}>
<SearchBar />
<ProductSwitcher isDropdown={!!props.sidebar} />
<div className={styles.sidebarHeaderFade}></div>
</div>
<div className={styles.sidebarNav}>
{!!props.sidebar && <TOC {...props} />}
<hr />
<NavbarColorModeToggle className={styles.colorModeToggle} />
</div>
</div>
);
};
Expand Down
26 changes: 24 additions & 2 deletions src/theme/DocSidebar/Desktop/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
}

.sidebar {
padding: 30px 30px 0;
max-height: 100dvh;
padding-top: 30px;
height: 100dvh;
width: 300px;
position: relative;
& nav {
padding: 0;
}
Expand All @@ -22,6 +23,27 @@
width: auto !important;
}
}
.sidebarHeader {
position: relative;
z-index: 10;
padding: 0 30px;
}
.sidebarHeaderFade {
height: 15px;
background: linear-gradient(180deg, rgba(249,249,249,1) 0%, rgba(249,249,249,0) 100%);
}
.sidebarNav {
margin-top: -15px;
padding: 30px;
height: calc(100% - 180px);
overflow-y: auto;
& > div {
margin-top: 15px;
}
& div {
height: auto;
}
}

.colorModeToggle {
margin-bottom: 16px;
Expand Down

0 comments on commit 367b163

Please sign in to comment.