store
1 year ago
AddonRow.jsx
1 year ago
App.jsx
1 year ago
Metabox.jsx
1 year ago
Modal.jsx
1 year ago
Notices.jsx
1 year ago
Select2.jsx
1 year ago
Settings.jsx
1 year ago
Step1.jsx
1 year ago
Step2.jsx
1 year ago
Step3.jsx
1 year ago
StepWrapper.jsx
1 year ago
main.js
1 year ago
Step1.jsx
54 lines
| 1 | /** |
| 2 | * WordPress Dependencies |
| 3 | */ |
| 4 | import { useContext, useState } from '@wordpress/element'; |
| 5 | |
| 6 | /** |
| 7 | * Internal Dependencies |
| 8 | */ |
| 9 | import { OneClickContext } from './store/context'; |
| 10 | |
| 11 | export default function Step1() { |
| 12 | const [state, setState] = useState(false); |
| 13 | const { setStep, toggleMetabox } = useContext(OneClickContext); |
| 14 | const { step1 } = advancedAds.oneclick; |
| 15 | |
| 16 | const onCancel = () => { |
| 17 | setState(false); |
| 18 | toggleMetabox(false); |
| 19 | setStep(1); |
| 20 | }; |
| 21 | |
| 22 | const onAgree = () => { |
| 23 | setStep(2); |
| 24 | }; |
| 25 | |
| 26 | return ( |
| 27 | <div className="mt-6 mb-8"> |
| 28 | <p dangerouslySetInnerHTML={{ __html: step1.content }}></p> |
| 29 | <p> |
| 30 | <label htmlFor="consent"> |
| 31 | <input |
| 32 | type="checkbox" |
| 33 | id="consent" |
| 34 | onClick={() => setState(!state)} |
| 35 | /> |
| 36 | <span>{step1.agreeText}</span> |
| 37 | </label> |
| 38 | </p> |
| 39 | <p className="buttons-set"> |
| 40 | <button |
| 41 | className="button button-primary" |
| 42 | disabled={!state} |
| 43 | onClick={onAgree} |
| 44 | > |
| 45 | {step1.btnAgree} |
| 46 | </button> |
| 47 | <button className="button" onClick={onCancel}> |
| 48 | {advancedAds.oneclick.btnCancel} |
| 49 | </button> |
| 50 | </p> |
| 51 | </div> |
| 52 | ); |
| 53 | } |
| 54 |