PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / app / modules / kit-library / assets / js / components / apply-kit-dialog.js

apply-kit-dialog.js in Elementor Website Builder – more than just a page builder 3.8.0-beta1, at app/modules/kit-library/assets/js/components/apply-kit-dialog.js

49 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useCallback } from 'react';
2 import { useNavigate } from '@reach/router';
3 import { Dialog } from '@elementor/app-ui';
4
5 export default function ApplyKitDialog( props ) {
6 const navigate = useNavigate();
7
8 const startImportProcess = useCallback( ( applyAll = false ) => {
9 let url = '/import/process' +
10 `?file_url=${ encodeURIComponent( props.downloadLink ) }` +
11 `&nonce=${ props.nonce }&referrer=kit-library`;
12
13 if ( applyAll ) {
14 url += '&action_type=apply-all';
15 }
16
17 navigate( url );
18 }, [ props.downloadLink, props.nonce ] );
19
20 return (
21 <Dialog
22 // Translators: %s is the kit name.
23 title={ __( 'Apply %s?', 'elementor' ).replace( '%s', props.title ) }
24 text={ <>
25 { __( 'You can use everything in this kit, or Customize to only include some items.', 'elementor' ) }
26 <br /><br />
27 { __( 'By applying the entire kit, you\'ll override any styles, settings or content already on your site.', 'elementor' ) }
28 </> }
29 approveButtonText={ __( 'Apply All', 'elementor' ) }
30 approveButtonColor="primary"
31 approveButtonOnClick={ () => startImportProcess( true ) }
32 dismissButtonText={ __( 'Customize', 'elementor' ) }
33 dismissButtonOnClick={ () => startImportProcess( false ) }
34 onClose={ props.onClose }
35 />
36 );
37 }
38
39 ApplyKitDialog.propTypes = {
40 downloadLink: PropTypes.string.isRequired,
41 nonce: PropTypes.string.isRequired,
42 onClose: PropTypes.func.isRequired,
43 title: PropTypes.string,
44 };
45
46 ApplyKitDialog.defaultProps = {
47 title: 'Kit',
48 };
49