-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react' | ||
|
||
export const Modal = ({id, header, body, onClose}) => { | ||
return <div id={id || 'Modal'} className='fixed w-screen h-fit z-50 flex justify-center items-center top-1/2'> | ||
<div className='bg-gr px-6 py-2'> | ||
<header className='flex items-center px-2 py-3 justify-between'> | ||
<h3 className='text-xl'>{header ? header : 'Header'}</h3> | ||
<span onClick={onClose} className='text-rose-500 cursor-pointer'>×</span> | ||
</header> | ||
<div className='px-2 py-3 text-sm'> | ||
{ | ||
body ? body : <div> | ||
<p>This is our Modal Body</p> | ||
</div> | ||
} | ||
</div> | ||
</div> | ||
</div> | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { useState } from "react"; | ||
import { Modal } from "./Modal"; | ||
|
||
export const ModalPopup = () => { | ||
const [showModalPopup, setShowModalPopup] = useState(false) | ||
|
||
function handleToggleModalPopup() { | ||
setShowModalPopup(!showModalPopup) | ||
} | ||
function onClose(){ | ||
setShowModalPopup(false) | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col gap-3 justify-start items-center py-5"> | ||
<Button onClick={handleToggleModalPopup} >Open Modal Popup</Button> | ||
{ | ||
showModalPopup && <Modal onClose={onClose} body={<div>Customized Body</div>} /> | ||
} | ||
</div> | ||
); | ||
}; |