PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.14.3
GiveWP – Donation Plugin and Fundraising Platform v4.14.3
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / Campaigns / resources / admin / components / FormModal / index.tsx
index.tsx
45 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import ModalDialog from '@givewp/components/AdminUI/ModalDialog';
2 import ErrorMessages from './ErrorMessages';
3 import styles from './FormModal.module.scss';
4
5 /**
6 * Form Modal component that renders a modal with a styled form inside
7 *
8 * @since 4.0.0
9 */
10 export default function FormModal({
11 isOpen,
12 handleClose,
13 title,
14 handleSubmit,
15 errors,
16 className,
17 children,
18 }: FormModalProps) {
19 return (
20 <ModalDialog
21 isOpen={isOpen}
22 showHeader={true}
23 handleClose={handleClose}
24 title={title}
25 wrapperClassName={styles.formModal}
26 >
27 <form className={`givewp-campaigns__form ${className}`} onSubmit={handleSubmit}>
28 <ErrorMessages errors={errors} />
29
30 {children}
31 </form>
32 </ModalDialog>
33 );
34 }
35
36 interface FormModalProps {
37 isOpen: boolean;
38 handleClose: () => void;
39 title: string;
40 handleSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
41 errors: Record<string, any>;
42 className: string;
43 children: JSX.Element | JSX.Element[];
44 }
45