| 1 |
import {useContext} from 'react'; |
| 2 |
import {__} from '@wordpress/i18n'; |
| 3 |
import {ExitIcon, StarsIcon} from '@givewp/components/AdminUI/Icons'; |
| 4 |
import {OnboardingContext} from '../index'; |
| 5 |
import styles from '../style.module.scss'; |
| 6 |
|
| 7 |
export default function Banner() { |
| 8 |
|
| 9 |
const [, setState] = useContext(OnboardingContext); |
| 10 |
|
| 11 |
const openFeatureNoticeModal = () => setState(prev => ({ |
| 12 |
...prev, |
| 13 |
showFeatureNoticeDialog: true |
| 14 |
})); |
| 15 |
|
| 16 |
const handleClose = () => { |
| 17 |
fetch(window.GiveDonationForms.bannerActionUrl, {method: 'POST'}) |
| 18 |
.then(() => setState(prev => ({ |
| 19 |
...prev, |
| 20 |
showBanner: false |
| 21 |
}))) |
| 22 |
}; |
| 23 |
|
| 24 |
|
| 25 |
return ( |
| 26 |
<div className={styles.banner}> |
| 27 |
<div className={styles.icon}> |
| 28 |
<StarsIcon /> |
| 29 |
</div> |
| 30 |
<div className={styles.text}> |
| 31 |
<span> |
| 32 |
{__('GiveWP 3.0 introduces customizable and flexible forms powered by the new Visual Donation Form Builder.', 'give')} |
| 33 |
</span> |
| 34 |
<button |
| 35 |
className={styles.button} |
| 36 |
onClick={openFeatureNoticeModal} |
| 37 |
> |
| 38 |
{__('Try the new form builder', 'give')} |
| 39 |
</button> |
| 40 |
</div> |
| 41 |
<div className={styles.closeIcon}> |
| 42 |
<ExitIcon onClick={handleClose} /> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
); |
| 46 |
} |
| 47 |
|