Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Sidebar position sticky #1086

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
return (
<div className='max-w-[1400px] mx-auto flex flex-col items-center'>
<section>
<div className='bg-primary dark:bg-slate-900 w-full h-12 mt-[4.5rem] z-150 flex relative flex-col justify-center items-center lg:hidden '>
<div className='bg-primary dark:bg-slate-900 w-full h-12 mt-[4.5rem] z-150 flex relative flex-col justify-center items-center lg:hidden '>
<div
className='z-[150] flex w-full bg-primary dark:bg-slate-900 justify-between items-center'
onMouseDown={(e) => e.stopPropagation()}
Expand All @@ -197,15 +197,12 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
{getStartedPath.includes(pathWtihoutFragment) && (
<h3 className='text-white ml-12'>Getting Started</h3>
)}

{getReferencePath.includes(pathWtihoutFragment) && (
<h3 className='text-white ml-12'>Reference</h3>
)}

{getSpecificationPath.includes(pathWtihoutFragment) && (
<h3 className='text-white ml-12'>Specification</h3>
)}

{router.pathname === null && (
<h3 className='text-white ml-12'>Docs</h3>
)}
Expand All @@ -232,17 +229,19 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
<div
className={`z-[150] absolute top-10 mt-24 left-0 h-full w-screen bg-white dark:bg-slate-900 dark:shadow-lg transform ${open ? '-translate-x-0' : '-translate-x-full'} transition-transform duration-300 ease-in-out filter drop-shadow-md `}
>
<div className='flex flex-col dark:bg-slate-900'>
<div className='flex flex-col dark:bg-slate-900'>
<DocsNav open={open} setOpen={setOpen} />
</div>
</div>
<div className='dark:bg-slate-800 max-w-[1400px] grid grid-cols-1 lg:grid-cols-4 mx-4 md:mx-12'>
<div className='hidden lg:block mt-24'>
<DocsNav open={open} setOpen={setOpen} />
<CarbonAds
className='lg:mt-8 w-4/5 mx-auto lg:ml-4'
variant='sidebar'
/>
<div className='hidden lg:block mt-24 mb-72 sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden'>
<DocsNav open={open} setOpen={setOpen} />
<CarbonAds
className='lg:mt-8 w-4/5 mx-auto lg:ml-4'
variant='sidebar'
/>
</div>
</div>
<div className='col-span-4 md:col-span-3 lg:mt-20 lg:w-5/6 mx-4 md:mx-0'>
{children}
Expand Down
6 changes: 6 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,9 @@ border-radius: 4px; */
background: grey;
border-radius: 8px;
}
.scrollbar-hidden {
scrollbar-width: none;
}
.scrollbar-hidden::-webkit-scrollbar {
display: none;
}
Loading