Skip to content

Commit

Permalink
mod: Created a modal that explains the game rules
Browse files Browse the repository at this point in the history
Signed-off-by: RareMmemshima <[email protected]>
  • Loading branch information
RareMmemshima committed Jan 29, 2025
1 parent afd9bc9 commit 1be5e54
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
23 changes: 1 addition & 22 deletions packages/nextjs/app/coinflip/_components/CoinflipPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,10 @@ import { ConflipPlayPage } from './ConflipPlayPage';
import { QuestionMarkCircleIcon } from '@heroicons/react/24/solid';
import GenericModal from '~~/components/scaffold-stark/CustomConnectButton/GenericModal';
import { tips } from '~~/utils/Constants';
import Modal from '~~/components/ui/Modal';


export const Modal = ({ isOpen, onClose, children }) => {
if (!isOpen) return null;

return (
<div
className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50"
onClick={onClose}
>
<div
className="modal-box modal-border bg-modal rounded-[8px] border flex flex-col gap-3 justify-around relative "
onClick={(e) => e.stopPropagation()}
>
<button
onClick={onClose}
className="absolute top-4 right-4 text-gray-500 hover:text-gray-800"
>
</button>
{children}
</div>
</div>
);
};

export const CoinflipPage = () => {

Expand Down
29 changes: 29 additions & 0 deletions packages/nextjs/components/ui/Modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const Modal = ({ isOpen, onClose, children }: {
isOpen: boolean,
onClose: ()=> void,
children: React.ReactNode
}) => {
if (!isOpen) return null;

return (
<div
className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50"
onClick={onClose}
>
<div
className="modal-box modal-border bg-modal rounded-[8px] border flex flex-col gap-3 justify-around relative "
onClick={(e) => e.stopPropagation()}
>
<button
onClick={onClose}
className="absolute top-4 right-4 text-gray-500 hover:text-gray-800"
>
</button>
{children}
</div>
</div>
);
};

export default Modal;

0 comments on commit 1be5e54

Please sign in to comment.