-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Separate "Design Selector" from design tour (#6983)
- Loading branch information
Showing
18 changed files
with
344 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ources/js/form-builder/src/components/onboarding/DesignSelector/components/DesignCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import cx from 'classnames'; | ||
import CheckCircleIcon from "../icons/check-circle" | ||
import {setFormSettings, useFormState, useFormStateDispatch} from "@givewp/form-builder/stores/form-state"; | ||
|
||
const DesignCard = ({title, description, image, alt, selected, onSelected}) => { | ||
return <div | ||
className={cx('givewp-design-selector--card', {selected: selected})} | ||
onClick={onSelected} | ||
> | ||
<img src={image} alt={alt} /> | ||
<strong>{title}</strong> | ||
<p>{description}</p> | ||
{selected && <CheckCircleIcon />} | ||
</div> | ||
} | ||
|
||
export default DesignCard; |
File renamed without changes.
File renamed without changes
File renamed without changes
73 changes: 73 additions & 0 deletions
73
src/FormBuilder/resources/js/form-builder/src/components/onboarding/DesignSelector/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import {useState, useContext} from 'react'; | ||
import {Button, Modal} from "@wordpress/components" | ||
import {ShepherdTourContext} from "react-shepherd" | ||
import {__} from "@wordpress/i18n"; | ||
import DesignCard from "./components/DesignCard"; | ||
|
||
// @ts-ignore | ||
import classDesignScreenshot from "./images/classic-design-screenshot.png"; | ||
|
||
// @ts-ignore | ||
import multiStepDesignScreenshot from "./images/multi-step-design-screenshot.png"; | ||
import {setFormSettings, useFormState, useFormStateDispatch} from "@givewp/form-builder/stores/form-state"; | ||
|
||
export default ({onContinue}) => { | ||
const tour = useContext(ShepherdTourContext); | ||
|
||
const dispatch = useFormStateDispatch(); | ||
|
||
const onProceed = () => { | ||
onContinue() | ||
window.onboardingTourData.autoStartDesignTour && tour.start() | ||
} | ||
|
||
const [selectedDesign, setSelectedDesign] = useState(null) | ||
|
||
const onDesignSelected = (design) => { | ||
setSelectedDesign(design) | ||
dispatch(setFormSettings({designId: design})) | ||
} | ||
|
||
return <Modal | ||
bodyOpenClassName={'show-design-selector-modal'} | ||
title={null} | ||
isDismissible={false} | ||
shouldCloseOnEsc={false} | ||
shouldCloseOnClickOutside={false} | ||
onRequestClose={() => null} | ||
> | ||
<div className={'givewp-design-selector--container'}> | ||
<header className={'givewp-design-selector--header'}> | ||
<h3> | ||
{__('Choose your form design', 'give')} | ||
</h3> | ||
<p> | ||
{__('Select one that suits your taste and requirements for your cause.', 'give')} | ||
</p> | ||
</header> | ||
|
||
<div className={'givewp-design-selector--cards'}> | ||
<DesignCard | ||
selected={selectedDesign === 'classic'} | ||
onSelected={() => onDesignSelected('classic')} | ||
image={classDesignScreenshot} | ||
alt={__('Classic form design', 'give')} | ||
title={__('Classic', 'give')} | ||
description={__('This displays all form fields on one page. Donors fill out the form as they scroll down the page', 'give')} | ||
/> | ||
<DesignCard | ||
selected={selectedDesign === 'multi-step'} | ||
onSelected={() => onDesignSelected('multi-step')} | ||
image={multiStepDesignScreenshot} | ||
alt={__('Multi-Step form design', 'give')} | ||
title={__('Multi-step', 'give')} | ||
description={__('This walks the donor through a number of steps to the donation process. The sections are broken into steps in the form', 'give')} | ||
/> | ||
</div> | ||
|
||
<Button disabled={!selectedDesign} className={'givewp-design-selector--button'} variant={'primary'} onClick={onProceed}> | ||
{__('Proceed', 'give')} | ||
</Button> | ||
</div> | ||
</Modal> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/FormBuilder/resources/js/form-builder/src/components/onboarding/SchemaWelcome/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {useContext} from 'react'; | ||
import {__} from "@wordpress/i18n"; | ||
import {ShepherdTourContext} from "react-shepherd" | ||
import {Button, Modal} from "@wordpress/components" | ||
import Logo from '@givewp/form-builder/components/icons/logo'; | ||
|
||
export default ({onContinue}) => { | ||
const tour = useContext(ShepherdTourContext); | ||
|
||
const onProceed = () => { | ||
onContinue() | ||
tour.start() | ||
} | ||
|
||
return <Modal | ||
bodyOpenClassName={'show-schema-welcome-modal'} | ||
title={null} | ||
isDismissible={false} | ||
shouldCloseOnEsc={false} | ||
shouldCloseOnClickOutside={false} | ||
onRequestClose={() => null} | ||
> | ||
<div className={'givewp-schema-welcome--container'}> | ||
<div> | ||
<div style={{display: 'flex', justifyContent: 'center', margin: '0 auto var(--givewp-spacing-4)'}}> | ||
<Logo /> | ||
</div> | ||
|
||
<h3> | ||
{__('Welcome to the visual donation form builder!', 'give')} | ||
</h3> | ||
|
||
<p> | ||
{__('The following is a quick (less than a minute) tour of the visual donation form builder, to introduce the tools for creating engaging donation forms.', 'give')} | ||
</p> | ||
</div> | ||
|
||
<Button className={'givewp-schema-welcome--button'} variant={'primary'} onClick={onProceed}> | ||
{__('Get started', 'give')} | ||
</Button> | ||
</div> | ||
</Modal> | ||
} |
12 changes: 0 additions & 12 deletions
12
...ilder/resources/js/form-builder/src/components/onboarding/steps/components/DesignCard.tsx
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
...er/resources/js/form-builder/src/components/onboarding/steps/components/DesignWelcome.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.