balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

OptionStep.js (2177B)


      1 import {pluginInfo} from '~redux-templates/stores/dependencyHelper';
      2 import {Tooltip} from '@wordpress/components';
      3 
      4 const {apiFetch} = wp;
      5 const {compose} = wp.compose;
      6 const {withDispatch} = wp.data;
      7 const {Fragment, useState} = wp.element;
      8 const {__} = wp.i18n;
      9 
     10 function OptionStep(props) {
     11 
     12     const {setImportToAppend, toNextStep, onCloseWizard} = props;
     13 
     14     const onNextStep = (isToAppend) => {
     15         setImportToAppend(isToAppend);
     16         toNextStep();
     17     }
     18 
     19     return (
     20 
     21         <Fragment>
     22             <div className="redux-templates-modal-body">
     23                 <h5>{__('Append or Replace', redux_templates.i18n)}</h5>
     24                 <p>{__('You have existing content on this page. How would you like to handle the import of this page template?', redux_templates.i18n)}</p>
     25 	            <div style={{textAlign:'center', marginTop: '30px'}}>
     26 		            {/*<Tooltip text={__('This template will be added to the bottom of the existing content.', redux_templates.i18n)} position="bottom center">*/}
     27 			            <button className="button button-primary" onClick={() => onNextStep(true)} style={{marginRight: '10px'}}>
     28 				            {__('Append to Content', redux_templates.i18n)}
     29 			            </button>
     30 		            {/*</Tooltip>*/}
     31 		            {/*<Tooltip text={__('All the existing content will be replaced with this new template.', redux_templates.i18n)} position="top right">*/}
     32 			            <button className="button button-primary" onClick={() => onNextStep(false)}>
     33 				            {__('Replace all Content', redux_templates.i18n)}
     34 			            </button>
     35 		            {/*</Tooltip>*/}
     36 	            </div>
     37             </div>
     38             <div className="redux-templates-modal-footer">
     39                 <button className="button button-secondary" onClick={onCloseWizard}>
     40                     {__('Cancel', redux_templates.i18n)}
     41                 </button>
     42             </div>
     43         </Fragment>
     44     );
     45 }
     46 
     47 
     48 export default compose([
     49     withDispatch((dispatch) => {
     50         const {
     51             setImportToAppend
     52         } = dispatch('redux-templates/sectionslist');
     53         return {
     54             setImportToAppend
     55         };
     56     })
     57 ])(OptionStep);