Created
December 9, 2024 17:07
-
-
Save 6TELOIV/fbe8938a32bb33fedc9dd88ddffb0bd8 to your computer and use it in GitHub Desktop.
Modal on top of route NextJS
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
/* app/@modal/default.tsx */ | |
export default function Default() { | |
return null | |
} |
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
/* app/@modal/modal/page.tsx */ | |
export default function Modal() { | |
return ( | |
<div> | |
<h2>Modal</h2> | |
<p>This is a modal</p> | |
</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
/* app/layout.tsx */ | |
export default function TestLayout({ | |
children, | |
modal, | |
}: { | |
children: React.ReactNode | |
modal: React.ReactNode | |
}) { | |
return ( | |
<html> | |
<body> | |
<div> | |
<h1>Test Layout</h1> | |
{children} | |
{modal} | |
</div> | |
</body> | |
</html> | |
) | |
} |
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
/* app/page.tsx and app/modal/page.tsx */ | |
import WorkRequestPage from '@/components/work-request-page' | |
export default WorkRequestPage |
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
/* components/work-request-page.tsx */ | |
export default function WorkRequestPage() { | |
return ( | |
<div> | |
<h2>Work Request Page</h2> | |
<p>This is a the work requests page</p> | |
<a href="/modal">Open Modal</a> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File structure: