Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions components/drip/modal/basicModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { useState } from "react";

const BasicModal = ({ children, basicModalRef, onClose, open }) => {
const closeModal = () => {
onClose(false);
};
return (
<div
ref={basicModalRef}
onClick={closeModal}
className={`fixed inset-0 bg-black bg-opacity-50 z-50 flex justify-center items-center transition-opacity duration-300 ${
open ? "opacity-100" : "opacity-0 pointer-events-none"
}`}
>
<article
onClick={(e) => e.stopPropagation()}
className="flex flex-col w-full max-w-[90vw] sm:max-w-lg md:max-w-xl lg:max-w-2xl max-h-[90vh] bg-white rounded-lg overflow-hidden"
>
<header className="flex items-center justify-between p-4 sm:p-6 bg-white border-b border-gray-200">
<h2 className="text-lg sm:text-xl font-semibold text-gray-800">
Welcome to the modal
</h2>
<button
onClick={closeModal}
className="text-gray-400 hover:text-gray-600 bg-gray-100 hover:bg-gray-200 rounded-sm text-sm inline-flex h-8 w-8 sm:h-9 sm:w-9 justify-center items-center transition-colors duration-200"
>
<svg
className="w-4 h-4 sm:w-5 sm:h-5"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 14 14"
>
<path
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"
/>
</svg>
<span className="sr-only">Close modal</span>
</button>
</header>
<main className="p-4 sm:p-6 bg-white overflow-y-auto max-h-[60vh] sm:max-h-[70vh]">
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Molestiae
eligendi quo possimus corporis. Aliquam adipisci ipsum earum, nam et
in voluptatum nesciunt eveniet, repudiandae corporis reiciendis.
Voluptas libero enim officiis, at obcaecati, dolores quidem
accusantium autem officia nisi itaque nostrum vel repellendus hic
cupiditate saepe perferendis nobis illo impedit sit ad deserunt
repellat cum inventore? Ut quo quisquam dolorem consequuntur in, eum
aspernatur voluptas sapiente, illo sunt optio ipsum, eos aut est
eius temporibus eveniet harum. Neque error quo deserunt id
laudantium
</p>
</main>
<footer className="flex items-center justify-end gap-2 p-4 sm:p-6 bg-white border-t border-gray-200">
<button
onClick={closeModal}
className="text-gray-500 hover:text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-sm text-sm sm:text-base inline-flex h-8 sm:h-9 px-4 sm:px-6 justify-center items-center transition-colors duration-200"
>
Cancel
</button>

<button
onClick={closeModal}
className="text-slate-50 hover:text-slate-100 bg-slate-700 hover:bg-slate-900 rounded-sm text-sm sm:text-base inline-flex h-8 sm:h-9 px-4 sm:px-6 justify-center items-center transition-colors duration-200"
>
Accept
</button>
</footer>
</article>
</div>
);
};

export default BasicModal;
86 changes: 86 additions & 0 deletions components/drip/modal/confirmationModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
const ConfirmationModal = ({
open,
onClose,
ConfirmationModalRef,
title,
onConfirm,
onCancel,
}) => {
return (
<>
<div
ref={ConfirmationModalRef}
onClick={onClose}
style={{ display: open ? "flex" : "none" }}
className="flex justify-center items-center w-full h-[100vh] fixed top-0 left-0 bg-[rgba(0,0,0,.5)] z-50 transition-opacity duration-300"
>
<article
onClick={(e) => e.stopPropagation()}
className="relative backdrop-blur-md p-4 w-full max-w-md max-h-full"
>
<div className="relative bg-white rounded-sm shadow-sm">
<button
type="button"
onClick={onClose}
className="absolute b top-3 right-3 end-2.5 text-gray-400 bg-[rgba(0,0,0,.1)] rounded-sm text-sm w-8 h-8 ms-auto inline-flex justify-center items-center cursor-pointer "
>
<svg
className="w-3 h-3"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 14 14"
>
<path
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"
/>
</svg>
<span className="sr-only">Close modal</span>
</button>
<div className="p-4 md:p-5 text-center">
<svg
className="mx-auto mb-4 text-gray-400 w-12 h-12 "
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 20 20"
>
<path
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"
/>
</svg>

<h3 className="mb-5 text-lg font-normal text-gray-500 ">
{title || " Are you sure you want to delete this product?"}
</h3>
<div className="flex justify-center gap-3">
<button
type="button"
onClick={onConfirm}
className="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-sm text-sm inline-flex items-center px-5 py-2.5 text-center"
>
Yes, I'm sure
</button>
<button
onClick={onCancel}
type="button"
className="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-sm border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 "
>
No, cancel
</button>
</div>
</div>
</div>
</article>
</div>
</>
);
};

export default ConfirmationModal;
Loading