-
-
Notifications
You must be signed in to change notification settings - Fork 451
[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
Yashwanth1906
wants to merge
10
commits into
json-schema-org:main
Choose a base branch
from
Yashwanth1906:Top-bar-menu-mobile-dimension
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
22800e5
[fix] : Adjusted the Menu DropDown the Navigation Top Bar
Yashwanth1906 fc745db
Merge branch 'json-schema-org:main' into Top-bar-menu-mobile-dimension
Yashwanth1906 b45dbeb
[feat] : Adjusted the Top bar menu toggle
Yashwanth1906 3f92289
[feat] : Syncronized the top menu bar and the sidebar
Yashwanth1906 26df7fe
[feat] : Scroll lock implied
Yashwanth1906 0131cc2
[fix] : Lint not fixed
Yashwanth1906 b514fc7
Merge branch 'Top-bar-menu-mobile-dimension' into main
Yashwanth1906 d268fa5
[feat] : Done with Top bar menu handling and scroll lock
Yashwanth1906 6be2b1a
[fix] : Lint fixed
Yashwanth1906 ed2ee7f
Merge branch 'Top-bar-menu-mobile-dimension' of github.com:Yashwanth1β¦
Yashwanth1906 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,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], | ||
|
|
@@ -106,8 +117,12 @@ export default function Layout({ | |
| <MainNavigation /> | ||
| </div> | ||
| </header> | ||
| <div ref={mobileNavRef}> | ||
| {showMobileNav && <MobileNav />} | ||
| <div ref={mobileNavRef}>{showMobileNav && <MobileNav />}</div> | ||
| <div | ||
| className={`transition-all duration-300 ${ | ||
| showMobileNav ? 'mt-[200px]' : 'mt-0' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should avoid hardcoding the margins. This could break the UI if the navbarβs style changes or nav items are added or removed |
||
| }`} | ||
| > | ||
| {children} | ||
| </div> | ||
| <ScrollButton /> | ||
|
|
@@ -300,29 +315,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> | ||
| ); | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hardcoding the overflow value to
unset, we should save the previous value and restore it.