From 66dac23f9dacb3ecc8fe1f736202718cbeaa7f1a Mon Sep 17 00:00:00 2001 From: Charles Graham SWT Date: Fri, 30 May 2025 08:35:08 -0500 Subject: [PATCH 1/4] Correct size issue, sizes did not cause any change --- lib/components/display/modal.jsx | 24 ++++++++++++++++-------- lib/utils/sizes.js | 13 ------------- 2 files changed, 16 insertions(+), 21 deletions(-) delete mode 100644 lib/utils/sizes.js diff --git a/lib/components/display/modal.jsx b/lib/components/display/modal.jsx index 55f0c354..d6665e2b 100644 --- a/lib/components/display/modal.jsx +++ b/lib/components/display/modal.jsx @@ -6,7 +6,18 @@ import { DialogBackdrop, } from "@headlessui/react"; import gwMerge from "../../gw-merge"; -import { WIDTH_OPTIONS } from "../../utils/sizes"; + +const WIDTH_OPTIONS = { + xs: "max-w-xs", + sm: "max-w-sm", + md: "max-w-md", + lg: "max-w-lg", + xl: "max-w-xl", + "2xl": "max-w-2xl", + "3xl": "max-w-3xl", + "4xl": "max-w-4xl", + "5xl": "max-w-5xl", +}; function Modal({ opened = false, @@ -18,15 +29,12 @@ function Modal({ className, children, }) { - // Check if the size exists + // Check if the size exists + const widthClass = WIDTH_OPTIONS[size] ?? WIDTH_OPTIONS["2xl"]; if (!WIDTH_OPTIONS[size]) { - console.error( - `Invalid size prop: ${size}. Must be one of: 'sx', 'sm', 'md', 'lg', 'xl', '2xl', '4xl', 'full'` - ); console.warn( - `Defaulting to '2xl' for size of ` + `Modal: invalid size "${size}" passed. Falling back to "2xl".` ); - size = "2xl"; } return ( @@ -40,7 +48,7 @@ function Modal({
Date: Fri, 30 May 2025 09:42:50 -0500 Subject: [PATCH 2/4] Change prop "buttons" to "footer" --- lib/components/display/modal.jsx | 26 ++++++++++++------- src/app-pages/documentation/display/modal.jsx | 8 +++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/lib/components/display/modal.jsx b/lib/components/display/modal.jsx index d6665e2b..04bd727d 100644 --- a/lib/components/display/modal.jsx +++ b/lib/components/display/modal.jsx @@ -24,16 +24,15 @@ function Modal({ onClose, dialogTitle, dialogDescription, - buttons, + footer, size = "2xl", className, children, }) { - // Check if the size exists const widthClass = WIDTH_OPTIONS[size] ?? WIDTH_OPTIONS["2xl"]; if (!WIDTH_OPTIONS[size]) { console.warn( - `Modal: invalid size "${size}" passed. Falling back to "2xl".` + `Modal: invalid size "${size}" passed. Falling back to "2xl".` ); } @@ -53,20 +52,29 @@ function Modal({ "gw-border", "gw-rounded-lg", "gw-shadow-lg", - "gw-bg-white", - "gw-p-12" + "gw-bg-white" )} > {dialogTitle && ( - + {dialogTitle} )} {dialogDescription && ( - {dialogDescription} + + {dialogDescription} + )} - {children} - {buttons} +
+ {children} +
+ {footer && ( +
+ {footer} +
+ )} + + {/* Resize Handle */}
diff --git a/src/app-pages/documentation/display/modal.jsx b/src/app-pages/documentation/display/modal.jsx index 9fb7e745..bd684a12 100644 --- a/src/app-pages/documentation/display/modal.jsx +++ b/src/app-pages/documentation/display/modal.jsx @@ -41,10 +41,10 @@ const componentProps = [ desc: "Description of the modal dialog.", }, { - name: "buttons", + name: "footer", type: "ReactNode", default: "null", - desc: "Button components to display at the bottom of the modal.", + desc: "Footer components to display at the bottom of the modal.", }, { name: "children", @@ -92,7 +92,7 @@ function ModalDocs() { dialogDescription="1-7 Day Quantitative Precipitation Forecast" size="2xl" staticWidth={true} - buttons={ + footer={