From 3d4b740e5a512db8fbdd934af2fbc9585fa00f0f Mon Sep 17 00:00:00 2001 From: polwex Date: Thu, 15 May 2025 18:47:59 +0700 Subject: thanks gemini, very pretty --- src/pages/test/trigger-modal-button.tsx | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/pages/test/trigger-modal-button.tsx (limited to 'src/pages/test/trigger-modal-button.tsx') diff --git a/src/pages/test/trigger-modal-button.tsx b/src/pages/test/trigger-modal-button.tsx new file mode 100644 index 0000000..eaa2dda --- /dev/null +++ b/src/pages/test/trigger-modal-button.tsx @@ -0,0 +1,37 @@ +"use client"; + +import { useState, ReactNode } from "react"; +import ClientModal from "./client-modal"; // The modal shell + +interface TriggerModalButtonProps { + children: ReactNode; // This will be the + buttonText?: string; + modalTitle?: string; +} + +export default function TriggerModalButton({ + children, + buttonText = "Open Product Details", + modalTitle, +}: TriggerModalButtonProps) { + const [isModalOpen, setIsModalOpen] = useState(false); + + return ( + <> + + + setIsModalOpen(false)} + title={modalTitle || ""} + > + {children} {/* Pass the Server Component content here */} + + + ); +} -- cgit v1.2.3