From 457024e804a70e3efa0d83849d181279bd7d5f38 Mon Sep 17 00:00:00 2001 From: Alastair Cottier Date: Tue, 22 Oct 2024 17:11:35 -0600 Subject: [PATCH 1/2] :lipstick: button touchups and modal effects --- src/components/Button.tsx | 6 ++-- src/components/Modal.tsx | 64 +++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 7c3352a..d74cd98 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -57,6 +57,8 @@ function Button({ const disabledButton = "bg-neutrals-light-500 text-neutrals-dark-200 border-transparent cursor-not-allowed"; + const textStyle = "text-body-reg text-center min-w-max"; + return ( ); } diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index db2fb24..fc36b0f 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -1,4 +1,5 @@ import clsx from "clsx"; +import { twMerge } from "tailwind-merge"; import { useEffect, useRef, useCallback } from "react"; import { X } from "@phosphor-icons/react"; @@ -56,8 +57,22 @@ function Modal({ xl: "w-[37.5rem]", }; + // Background style + const background = + "fixed inset-0 flex items-center justify-center bg-black bg-opacity-25"; + // Body style - const body = `flex flex-col p-8 gap-4 bg-neutrals-light-100 rounded-lg max-w-[80vw] max-h-[95vh] overflow-auto`; + const body = + "flex flex-col p-8 gap-4 bg-neutrals-light-100 rounded-lg max-w-[80vw] max-h-[95vh] overflow-auto scale-95"; + + // Transition style + const transition = "transition-all duration-200 ease-in-out"; + + // Closed style + const closed = "opacity-0 shadow-none pointer-events-none"; + + // Open style + const open = "opacity-100 shadow-lg pointer-events-auto scale-100"; // Header style const header = "flex flex-row w-full justify-between items-center"; @@ -118,31 +133,36 @@ function Modal({ return () => document.removeEventListener("keydown", handleKeyDown); }, [isOpen, closeable, disableCloseOnEscape, onClose]); - // Encapsulates the visibility of the modal in a prop - if (!isOpen) return null; - return (
-
-
- {icon} -

{title}

-
- {closeable && !hideCloseButton && ( -
- -
+
-
- {content} - {actions} + > +
+
+ {icon} +

{title}

+
+ {closeable && !hideCloseButton && ( +
+ +
+ )} +
+
+ {content} + {actions} +
); From aec0adfc13ec6ac2ca2dddf7c6ee024c362c3bb5 Mon Sep 17 00:00:00 2001 From: Alastair Cottier Date: Tue, 22 Oct 2024 17:13:19 -0600 Subject: [PATCH 2/2] :sparkles: add member modal into admin home --- src/components/AddMember.tsx | 26 ++++++++++++++++++++++---- src/routes/admin/AdminHome.tsx | 24 ++++++++++++++++++------ 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/components/AddMember.tsx b/src/components/AddMember.tsx index 339290f..fc79803 100644 --- a/src/components/AddMember.tsx +++ b/src/components/AddMember.tsx @@ -16,15 +16,33 @@ interface AddMemberProps { function AddMember({ isOpen, onClose }: AddMemberProps) { const [nameError, setNameError] = useState(false); const [idError, setIdError] = useState(false); + const [name, setName] = useState(""); + const [id, setId] = useState(""); // Content style const content = "flex flex-col gap-6"; + // Function to add member + const addMember = () => () => { + if (!nameError && !idError) { + resetAndClose(); + } + }; + + const resetAndClose = () => () => { + setNameError(false); + setIdError(false); + setName(""); + setId(""); + onClose(); + }; + return ( {}} + setInput={setName} /> {}} + setInput={setId} />
@@ -53,7 +71,7 @@ function AddMember({ isOpen, onClose }: AddMemberProps) {
+ setIsAddMemberModalOpen(false)} + />