Skip to content

Commit

Permalink
Updated MobileNavMenu & MenuBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEques committed Nov 4, 2023
1 parent 6657fb2 commit 379882e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
13 changes: 2 additions & 11 deletions components/navigation/MenuBlocks.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import { useState, useEffect, useRef } from 'react';
import Paragraph from '../typography/Paragraph';
import Label from './Label'
import Link from 'next/link'

export default function MenuBlocks ({
items = [],
}) {
const [height, setHeight] = useState(0);
const contentRef = useRef(null);

useEffect(() => {
setHeight(contentRef.current.clientHeight);
}, []);
return (
<div className="transition-height duration-700 ease-in-out overflow-hidden" style={{ height: height }}>
<div ref={contentRef}>
<>
{
items.map((item, index) => {
const isExternalHref = item.href && item.href.startsWith('http');
Expand All @@ -41,7 +33,6 @@ export default function MenuBlocks ({
)
})
}
</div>
</div>
</>
)
}
13 changes: 5 additions & 8 deletions components/navigation/MobileNavMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,15 @@ export default function MobileNavMenu({ onClickClose = () => {} }) {
</div>
</div>
<div className="py-2 px-5 space-y-2" onClick={() => showMenu('learning')}>
<h4 className="text-gray-800 font-medium flex justify-between">
<a className="cursor-pointer">Docs</a>
<NavItemDropdown />
</h4>
{open === 'learning' && <MenuBlocks items={learningItems} />}
</div>
<h4 className="text-gray-800 font-medium flex justify-between"> <a className="cursor-pointer"><Link href="/docs" className="flex">Docs</Link></a><NavItemDropdown/></h4>
{open === 'learning' && <MenuBlocks items={learningItems} />}
</div>
<div className="py-2 px-5 space-y-2" onClick={() => showMenu('tooling')}>
<h4 className="text-gray-800 font-medium flex justify-between"> <a className="cursor-pointer">Tools</a> <NavItemDropdown /> </h4>
<h4 className="text-gray-800 font-medium flex justify-between"> <a className="cursor-pointer"><Link href="/tools" className="flex">Tools</Link></a><NavItemDropdown/></h4>
{open === 'tooling' && <MenuBlocks items={toolingItems} />}
</div>
<div className="py-2 px-5 space-y-2" onClick={() => showMenu('community')}>
<h4 className="text-gray-800 font-medium flex justify-between"><a className="cursor-pointer">Community</a><NavItemDropdown /></h4>
<h4 className="text-gray-800 font-medium flex justify-between"><a className="cursor-pointer"><Link href="/community" className="flex">Community</Link></a><NavItemDropdown/></h4>
{open === 'community' && <MenuBlocks items={communityItems} />}
</div>
<div className="py-2 px-5 space-y-2" onClick={() => showMenu('others')}>
Expand Down

0 comments on commit 379882e

Please sign in to comment.