back-up-site.js
1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// @ts-check
/**
* External dependencies
*/
import * as React from 'react';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { ButtonNext, ButtonPrevious, Step, StepContent, StepFooter, StepIcon } from '../';
import { FIRST_STEP_NUMBER } from '../../constants';
/**
* @typedef {Object} BackUpSiteProps The component props.
* @property {boolean} isStepActive Whether this step is active.
* @property {boolean} isStepComplete Whether this step is complete.
* @property {number} stepIndex The step index of this step.
* @property {React.EventHandler<React.MouseEvent<HTMLButtonElement, MouseEvent>>} goToNext Goes to the next step.
* @property {React.EventHandler<React.MouseEvent<HTMLButtonElement, MouseEvent>>} goToPrevious Goes to the previous step.
*/
/**
* The step that prompts to back up the site.
*
* @param {BackUpSiteProps} Props The component props.
* @return {React.ReactElement} The component to prompt to back up the site.
*/
const BackUpSite = ( { isStepActive, isStepComplete, goToNext, goToPrevious, stepIndex } ) => {
const isFirstStep = FIRST_STEP_NUMBER === stepIndex;
return (
<Step isActive={ isStepActive } isComplete={ isStepComplete }>
<StepIcon
index={ stepIndex }
isComplete={ isStepComplete }
/>
<StepContent
heading={ __( 'Back Up Your Site', 'block-lab' ) }
isStepActive={ isStepActive }
>
<p>{ __( 'Migrating from Block Lab to Genesis Custom Blocks is a one-way action. It can’t be undone. Please back up your site before you begin, just in case you need to roll it back.', 'block-lab' ) }</p>
<StepFooter>
{ ! isFirstStep && <ButtonPrevious onClick={ goToPrevious } /> }
<ButtonNext
checkboxLabel={ __( 'I have backed up my site.', 'block-lab' ) }
onClick={ goToNext }
stepIndex={ stepIndex }
/>
</StepFooter>
</StepContent>
</Step>
);
};
export default BackUpSite;