Skip to content

Commit 22800e5

Browse files
committed
[fix] : Adjusted the Menu DropDown the Navigation Top Bar
1 parent 1ac0817 commit 22800e5

File tree

1 file changed

+51
-23
lines changed

1 file changed

+51
-23
lines changed

components/Layout.tsx

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ export default function Layout({
3535

3636
const mobileNavRef = useRef<HTMLDivElement>(null);
3737

38+
useEffect(() => {
39+
if (showMobileNav) {
40+
document.body.style.overflow = 'hidden';
41+
} else {
42+
document.body.style.overflow = 'unset';
43+
}
44+
return () => {
45+
document.body.style.overflow = 'unset';
46+
};
47+
}, [showMobileNav]);
48+
3849
React.useEffect(
3950
() => useStore.setState({ overlayNavigation: null }),
4051
[router.asPath],
@@ -103,7 +114,13 @@ export default function Layout({
103114
<MainNavigation />
104115
</div>
105116
</header>
106-
<div ref={mobileNavRef}>
117+
<div
118+
ref={mobileNavRef}
119+
className={classnames('transition-all duration-300 ease-in-out', {
120+
'mt-[280px]': showMobileNav,
121+
'mt-[64px]': !showMobileNav,
122+
})}
123+
>
107124
{showMobileNav && <MobileNav />}
108125
{children}
109126
</div>
@@ -293,29 +310,40 @@ const MobileNav = () => {
293310
const section = useContext(SectionContext);
294311

295312
return (
296-
<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'>
297-
<MainNavLink
298-
uri='/specification'
299-
label='Specification'
300-
isActive={section === 'specification'}
301-
/>
302-
<MainNavLink
303-
uri='/learn/getting-started-step-by-step'
304-
label='Docs'
305-
isActive={section === 'docs'}
306-
/>
313+
<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'>
314+
<div className='flex flex-col space-y-2 py-2'>
315+
<MainNavLink
316+
className='block py-1.5'
317+
uri='/specification'
318+
label='Specification'
319+
isActive={section === 'specification'}
320+
/>
321+
<MainNavLink
322+
className='block py-1.5'
323+
uri='/learn/getting-started-step-by-step'
324+
label='Docs'
325+
isActive={section === 'docs'}
326+
/>
307327

308-
<MainNavLink
309-
uri='/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=&environments='
310-
label='Tools'
311-
isActive={section === 'tools'}
312-
/>
313-
<MainNavLink uri='/blog' label='Blog' isActive={section === 'blog'} />
314-
<MainNavLink
315-
uri='/community'
316-
label='Community'
317-
isActive={section === 'community'}
318-
/>
328+
<MainNavLink
329+
className='block py-1.5'
330+
uri='/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=&environments='
331+
label='Tools'
332+
isActive={section === 'tools'}
333+
/>
334+
<MainNavLink
335+
className='block py-1.5'
336+
uri='/blog'
337+
label='Blog'
338+
isActive={section === 'blog'}
339+
/>
340+
<MainNavLink
341+
className='block py-1.5'
342+
uri='/community'
343+
label='Community'
344+
isActive={section === 'community'}
345+
/>
346+
</div>
319347
</div>
320348
);
321349
};

0 commit comments

Comments
 (0)