PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0
Elementor Website Builder – more than just a page builder v3.8.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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / app / modules / onboarding / assets / js / components / skip-button.js

skip-button.js in Elementor Website Builder – more than just a page builder 3.8.0, at app/modules/onboarding/assets/js/components/skip-button.js

50 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useContext } from 'react';
2 import { OnboardingContext } from '../context/context';
3 import { useNavigate } from '@reach/router';
4
5 import Button from './button';
6
7 export default function SkipButton( props ) {
8 const { button, className } = props,
9 { state, updateState } = useContext( OnboardingContext ),
10 navigate = useNavigate(),
11 skipStep = () => {
12 const mutatedState = JSON.parse( JSON.stringify( state ) );
13
14 mutatedState.steps[ state.currentStep ] = 'skipped';
15
16 updateState( mutatedState );
17
18 if ( state.nextStep ) {
19 navigate( 'onboarding/' + state.nextStep );
20 }
21 },
22 action = button.action || skipStep;
23
24 // Make sure the 'action' prop doesn't get printed on the button markup which causes an error.
25 delete button.action;
26
27 // If the button is a link, no onClick functionality should be added.
28 button.onClick = () => {
29 elementorCommon.events.dispatchEvent( {
30 event: 'skip',
31 version: '',
32 details: {
33 placement: elementorAppConfig.onboarding.eventPlacement,
34 step: state.currentStep,
35 },
36 } );
37
38 if ( ! button.href ) {
39 action();
40 }
41 };
42
43 return <Button buttonSettings={ button } className={ className } type="skip" />;
44 }
45
46 SkipButton.propTypes = {
47 button: PropTypes.object.isRequired,
48 className: PropTypes.string,
49 };
50