Skip to content

Commit

Permalink
Create baseline for modals for creating courses, uploading exams and …
Browse files Browse the repository at this point in the history
…admin tooling like managing courses and exams.

Closing button of modal is commented out and click outside to close is not implemented yet because of vercel/next.js#52681
  • Loading branch information
FinThunderstorm committed Jul 20, 2023
1 parent 73dce7e commit 433fb88
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/@modal/default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Default = () => {
return null
}

export default Default
5 changes: 5 additions & 0 deletions app/default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Default = () => {
return null
}

export default Default
1 change: 1 addition & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const RootLayout = ({
<Header />
<div className="bg-yellow-500 pb-5">
<div className="container mx-auto box-border max-w-screen-lg bg-gray-50 px-5 shadow-xl">
{modal}
{children}
</div>
</div>
Expand Down
36 changes: 36 additions & 0 deletions components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// "use client"
import React from 'react'

// import { useRouter } from 'next/navigation'
import { XCircleIcon } from '@heroicons/react/24/outline'

const Modal = ({
children,
title
}: {
children: React.ReactNode
title: string
}) => {
// const router = useRouter()

return (
<div className="fixed bottom-0 left-0 right-0 top-0 h-screen w-screen overflow-y-auto overflow-x-hidden bg-black/40">
<div className="pointer-events-none relative mx-auto mt-36 w-full">
<div className="pointer-events-auto flex w-full flex-col bg-white bg-clip-padding">
<div className="flex flex-shrink-0 items-center justify-between px-20 py-5">
<h3 className="font-serif text-4xl font-extrabold text-gray-800">
{title}
</h3>
{/* <button onClick={() => router.back()}> */}
<XCircleIcon className="h-8 w-8 flex-shrink-0" />
{/* <p className="sr-only">Close</p> */}
{/* </button> */}
</div>
<div className="px-20 py-5">{children}</div>
</div>
</div>
</div>
)
}

export default Modal

0 comments on commit 433fb88

Please sign in to comment.