PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
4.16.9 4.16.8.1 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 All 255 releases
give / src / DonationForms / FormDesigns / ClassicFormDesign / js / layouts / Header.tsx

Header.tsx in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/DonationForms/FormDesigns/ClassicFormDesign/js/layouts/Header.tsx

95 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {__} from '@wordpress/i18n';
2 import {HeaderProps} from '@givewp/forms/propTypes';
3
4 /**
5 * @since 4.3.0 replace <aside> landmark with div for accessibility audit.
6 * @since 3.0.0
7 */
8 const SecureBadge = () => {
9 return (
10 <div className="givewp-form-secure-badge">
11 <i className="fa-solid fa-lock givewp-secondary-color"></i>
12 <span>{__('100% Secure Donation', 'give')}</span>
13 </div>
14 );
15 };
16
17 /**
18 * @since 3.5.0 add HeaderImage
19 * @since 3.0.0
20 */
21 export default function Header({HeaderImage, Title, Description, Goal}: HeaderProps) {
22 const {designSettingsImageStyle, designSettingsImageUrl} = window.givewp.form.hooks.useDonationFormSettings();
23
24 if (!designSettingsImageUrl) {
25 return (
26 <div className={`givewp-layouts-header__templates`}>
27 <Title />
28 <Description />
29 <SecureBadge />
30 <Goal />
31 </div>
32 );
33 }
34
35 return (
36 <div
37 className={`givewp-layouts-header__templates givewp-layouts-header__templates--${designSettingsImageStyle}`}
38 >
39 <HeaderImageTemplates
40 imagePosition={designSettingsImageStyle}
41 HeaderImage={HeaderImage}
42 Title={Title}
43 Description={Description}
44 Goal={Goal}
45 />
46 </div>
47 );
48 }
49
50 function HeaderImageTemplates({imagePosition, HeaderImage, Title, Description, Goal}) {
51 switch (imagePosition) {
52 case 'background':
53 return (
54 <>
55 <HeaderImage />
56 <Title />
57 <Description />
58 <SecureBadge />
59 <Goal />
60 </>
61 );
62 case 'above':
63 return (
64 <>
65 <HeaderImage />
66 <div className={'givewp-layouts-header__content'}>
67 <Title />
68 <Description />
69 <SecureBadge />
70 <Goal />
71 </div>
72 </>
73 );
74 case 'center':
75 return (
76 <>
77 <Title />
78 <Description />
79 <SecureBadge />
80 <HeaderImage />
81 <Goal />
82 </>
83 );
84 default:
85 return (
86 <>
87 <Title />
88 <Description />
89 <SecureBadge />
90 <Goal />
91 </>
92 );
93 }
94 }
95