Skip to content

Commit 2332a77

Browse files
added call to action
1 parent 6043a33 commit 2332a77

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/components/modal-tour/editor.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
justify-content: flex-end;
5757
}
5858

59+
.ugb-tour-modal__cta {
60+
width: 100%;
61+
justify-content: center;
62+
margin: 16px 0 8px;
63+
}
64+
5965
&.ugb-tour-modal--right,
6066
&.ugb-tour-modal--left,
6167
&.ugb-tour-modal--top,

src/components/modal-tour/index.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ const STEPS = [
2424
anchor: '.ugb-modal-design-library__enable-background',
2525
position: 'right',
2626
nextEventTarget: '.ugb-modal-design-library__enable-background',
27-
// showNext: false,
27+
ctaLabel: __( 'Enable Background', i18n ),
28+
ctaOnClick: () => {
29+
const element = document.querySelector( '.ugb-modal-design-library__enable-background .components-form-toggle__input' )
30+
element?.click()
31+
},
32+
showNext: false,
2833
},
2934
{
3035
title: __( 'Patterns and Full-Pages', i18n ),
@@ -51,6 +56,8 @@ const ModalTour = props => {
5156
const {
5257
title,
5358
description,
59+
ctaLabel = null,
60+
ctaOnClick = NOOP,
5461
size = 'small',
5562
anchor = null, // This is a selector for the element to anchor the modal to. Defaults to middle of the screen.
5663
position = 'center', // This is the position to place the modal relative to the anchor. Can be 'left', 'right', 'top', 'bottom', 'center'.
@@ -161,6 +168,21 @@ const ModalTour = props => {
161168
}` }
162169
</style>
163170
{ description }
171+
{ ctaLabel && (
172+
<Button
173+
onClick={ () => {
174+
ctaOnClick()
175+
setCurrentStep( currentStep + 1 )
176+
setTimeout( () => {
177+
setForceRefresh( forceRefresh + 1 )
178+
}, 50 )
179+
} }
180+
variant="primary"
181+
className="ugb-tour-modal__cta"
182+
>
183+
{ ctaLabel }
184+
</Button>
185+
) }
164186
<Flex className="ugb-tour-modal__footer">
165187
<Steps
166188
numSteps={ steps.length }

0 commit comments

Comments
 (0)