Skip to content

[fix] : Adjusted the Menu DropDown the Navigation Top Bar #1712

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
74 changes: 51 additions & 23 deletions components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ export default function Layout({

const mobileNavRef = useRef<HTMLDivElement>(null);

useEffect(() => {
if (showMobileNav) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = 'unset';
}
return () => {
document.body.style.overflow = 'unset';
};
}, [showMobileNav]);

React.useEffect(
() => useStore.setState({ overlayNavigation: null }),
[router.asPath],
Expand Down Expand Up @@ -103,7 +114,13 @@ export default function Layout({
<MainNavigation />
</div>
</header>
<div ref={mobileNavRef}>
<div
ref={mobileNavRef}
className={classnames('transition-all duration-300 ease-in-out', {
'mt-[280px]': showMobileNav,
'mt-[64px]': !showMobileNav,
})}
>
{showMobileNav && <MobileNav />}
{children}
</div>
Expand Down Expand Up @@ -293,29 +310,40 @@ const MobileNav = () => {
const section = useContext(SectionContext);

return (
<div className='flex flex-col lg:hidden shadow-xl justify-end fixed bg-white w-full z-[190] top-16 left-0 pl-8 dark:bg-slate-800'>
<MainNavLink
uri='/specification'
label='Specification'
isActive={section === 'specification'}
/>
<MainNavLink
uri='/learn/getting-started-step-by-step'
label='Docs'
isActive={section === 'docs'}
/>
<div className='flex flex-col lg:hidden shadow-xl fixed bg-white w-full z-[190] top-16 left-0 pl-8 dark:bg-slate-800 transition-all duration-300 ease-in-out'>
<div className='flex flex-col space-y-2 py-2'>
<MainNavLink
className='block py-1.5'
uri='/specification'
label='Specification'
isActive={section === 'specification'}
/>
<MainNavLink
className='block py-1.5'
uri='/learn/getting-started-step-by-step'
label='Docs'
isActive={section === 'docs'}
/>

<MainNavLink
uri='/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=&environments='
label='Tools'
isActive={section === 'tools'}
/>
<MainNavLink uri='/blog' label='Blog' isActive={section === 'blog'} />
<MainNavLink
uri='/community'
label='Community'
isActive={section === 'community'}
/>
<MainNavLink
className='block py-1.5'
uri='/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=&environments='
label='Tools'
isActive={section === 'tools'}
/>
<MainNavLink
className='block py-1.5'
uri='/blog'
label='Blog'
isActive={section === 'blog'}
/>
<MainNavLink
className='block py-1.5'
uri='/community'
label='Community'
isActive={section === 'community'}
/>
</div>
</div>
);
};
Expand Down
Loading