From 34549fc4b6991fe2bf87a830cde9cf07c262fe2f Mon Sep 17 00:00:00 2001 From: kibin Date: Wed, 1 Apr 2026 07:53:26 +0000 Subject: [PATCH] fix(254): invoice modal scrollable with sticky footer buttons (#25) --- app/(app)/invoices/page.tsx | 22 ++++++++++++++-------- src/components/ui/Modal.tsx | 14 ++++++++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/app/(app)/invoices/page.tsx b/app/(app)/invoices/page.tsx index 77cc8b6..6be0257 100644 --- a/app/(app)/invoices/page.tsx +++ b/app/(app)/invoices/page.tsx @@ -154,7 +154,20 @@ export default function InvoicesPage() { {/* Invoice Detail Modal */} - setSelected(null)} title={`Invoice ${selected?.invoiceNumber ?? ""}`} className="max-w-lg"> + setSelected(null)} + title={`Invoice ${selected?.invoiceNumber ?? ""}`} + className="max-w-lg" + footer={selected ? ( + <> + {selected.status !== "VOID" && selected.status !== "PAID" && ( + + )} + + + ) : undefined} + > {selected && (
@@ -196,13 +209,6 @@ export default function InvoicesPage() { disabled={!payForm.amount}>Record Payment
)} - -
- {selected.status !== "VOID" && selected.status !== "PAID" && ( - - )} - -
)}
diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsx index 7713723..1ce1456 100644 --- a/src/components/ui/Modal.tsx +++ b/src/components/ui/Modal.tsx @@ -9,10 +9,11 @@ interface ModalProps { onClose: () => void; title: string; children: React.ReactNode; + footer?: React.ReactNode; className?: string; } -export function Modal({ isOpen, onClose, title, children, className }: ModalProps) { +export function Modal({ isOpen, onClose, title, children, footer, className }: ModalProps) { const overlayRef = useRef(null); useEffect(() => { @@ -31,8 +32,8 @@ export function Modal({ isOpen, onClose, title, children, className }: ModalProp className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4" onClick={(e) => e.target === overlayRef.current && onClose()} > -
-
+
+

{title}

-
{children}
+
{children}
+ {footer && ( +
+ {footer} +
+ )}
);