-
Notifications
You must be signed in to change notification settings - Fork 67
Feat: More Guided Tours #3639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kaeizen
wants to merge
12
commits into
develop
Choose a base branch
from
feat/more-guided-tours
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat: More Guided Tours #3639
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7d61922
layout adjustment
kaeizen 1d4042c
add block backgrounds & containers tour
kaeizen 3080663
add responsive controls
kaeizen ccad290
hover states
kaeizen 9de8c0c
add advanced hover states, color schemes, premium buttons
kaeizen 81b97ff
block styles
kaeizen 70962b8
add modal delay
kaeizen 22d00cd
custom css, copy paste styles
kaeizen 7b3693d
fix icons
kaeizen 44e5774
fix code rabbit's qa
kaeizen 3a72022
Merge branch 'develop' into feat/more-guided-tours
kaeizen bab77d9
fix to coderabbit's qa
kaeizen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
211 changes: 211 additions & 0 deletions
211
src/lazy-components/modal-tour/tours/block-backgrounds.js
This file contains hidden or 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,211 @@ | ||
| import { __ } from '@wordpress/i18n' | ||
| import { i18n } from 'stackable' | ||
| import { dispatch, select } from '@wordpress/data' | ||
| import { createInterpolateElement } from '@wordpress/element' | ||
|
|
||
| export const blockBackgrounds = { | ||
| initialize: () => { | ||
| // Add some default content that we will select | ||
|
|
||
| const blockObject = wp.blocks.createBlock( | ||
| 'stackable/columns', | ||
| { | ||
| uniqueId: '1dbe04e', | ||
| blockMargin: { bottom: '' }, | ||
| align: 'full', | ||
| containerWidth: 50, | ||
| containerHorizontalAlign: 'flex-start', | ||
| containerWidthUnit: '%', | ||
| }, | ||
| [ | ||
| wp.blocks.createBlock( | ||
| 'stackable/column', | ||
| { | ||
| uniqueId: 'f957abc', | ||
| columnSpacing: { | ||
| top: '', right: '', bottom: '', left: '', | ||
| }, | ||
| }, | ||
| [ | ||
| wp.blocks.createBlock( | ||
| 'stackable/heading', | ||
| { | ||
| uniqueId: 'a8ebea7', | ||
| // Retain our text | ||
| text: 'Explore the World with Us', | ||
| textTag: 'h2', | ||
| } | ||
| ), | ||
| wp.blocks.createBlock( | ||
| 'stackable/text', | ||
| { | ||
| uniqueId: '57e76a1', | ||
| // Retain our text | ||
| text: 'Discover breathtaking destinations, plan your next adventure, and make unforgettable memories with our travel guides and tips.', | ||
| } | ||
| ), | ||
| wp.blocks.createBlock( | ||
| 'stackable/button-group', | ||
| { uniqueId: 'e063798' }, | ||
| [ | ||
| wp.blocks.createBlock( | ||
| 'stackable/button', | ||
| { | ||
| uniqueId: '5d04ca8', | ||
| // Retain our text | ||
| text: 'Start your journey', | ||
| url: '', | ||
| } | ||
| ), | ||
| ] | ||
| ), | ||
| ] | ||
| ), | ||
| ] | ||
| ) | ||
| // Insert our block | ||
| dispatch( 'core/block-editor' ).insertBlocks( [ blockObject ], 0 ) | ||
|
|
||
| // Select the inner columns block for the tour | ||
| dispatch( 'core/block-editor' ).selectBlock( blockObject.clientId ) | ||
| }, | ||
| steps: [ | ||
| { | ||
| title: __( 'Discover Stackable Block Backgrounds & Containers', i18n ), | ||
| description: __( 'Welcome! Let\'s enhance your page by first adding a background to the Columns block. The Style Tab lets you tweak backgrounds, colors, borders, and typography for a custom look.', i18n ), | ||
| help: createInterpolateElement( __( 'Click the <strong>Style Tab</strong> in the sidebar to get started.', i18n ), { | ||
| strong: <strong />, | ||
| } ), | ||
| anchor: '.edit-post-sidebar__panel-tab.ugb-tab--style', | ||
| position: 'left', | ||
| glowTarget: '.edit-post-sidebar__panel-tab.ugb-tab--style', | ||
| nextEventTarget: '.edit-post-sidebar__panel-tab.ugb-tab--style', | ||
| preStep: () => { | ||
| // Open the inspector sidebar | ||
| dispatch( 'core/edit-post' ).openGeneralSidebar( 'edit-post/block' ) | ||
|
|
||
| // Look for the first "stackable/columns" block | ||
| const allBlocks = select( 'core/block-editor' ).getBlocks() | ||
| const columnsBlock = allBlocks.find( block => block.name === 'stackable/columns' ) | ||
| if ( columnsBlock ) { | ||
| dispatch( 'core/block-editor' ).selectBlock( columnsBlock.clientId ) | ||
| } | ||
| }, | ||
| postStep: () => { | ||
| // Click the tab | ||
| document.querySelector( '.edit-post-sidebar__panel-tab.ugb-tab--style:not(.is-active)' )?.click() | ||
| }, | ||
| }, | ||
| { | ||
| title: __( 'Enable a Block Background', i18n ), | ||
| description: __( 'Turn on the background option to instantly add a background layer to your section. Watch as your design transforms with a single toggle.', i18n ), | ||
| help: createInterpolateElement( __( 'Toggle ON the <strong>Background</strong> option to continue.', i18n ), { | ||
| strong: <strong />, | ||
| } ), | ||
| anchor: '.ugb-block-background-panel .components-panel__body-title', | ||
| position: 'left', | ||
| glowTarget: '.ugb-block-background-panel .components-panel__body-title', | ||
| nextEventTarget: '.ugb-block-background-panel .components-panel__body-title input[type="checkbox"]', | ||
| nextEvent: 'mousedown', | ||
| preStep: () => { | ||
| // Open the inspector sidebar | ||
| dispatch( 'core/edit-post' ).openGeneralSidebar( 'edit-post/block' ) | ||
|
|
||
| // Look for the first "stackable/columns" block | ||
| const allBlocks = select( 'core/block-editor' ).getBlocks() | ||
| const columnsBlock = allBlocks.find( block => block.name === 'stackable/columns' ) | ||
| if ( columnsBlock ) { | ||
| dispatch( 'core/block-editor' ).selectBlock( columnsBlock.clientId ) | ||
| } | ||
|
|
||
| setTimeout( () => { | ||
| // Click the tab | ||
| document.querySelector( '.edit-post-sidebar__panel-tab.ugb-tab--style:not(.is-active)' )?.click() | ||
| }, 100 ) | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| { | ||
| title: __( 'Customize the Background Color', i18n ), | ||
| description: __( 'Now let\'s personalize your section. Choose a background color to help your content stand out or integrate it seamlessly into your page design.', i18n ), | ||
| help: createInterpolateElement( __( 'Open the <strong>Background Color</strong> panel to select a color.', i18n ), { | ||
| strong: <strong />, | ||
| } ), | ||
| anchor: '.stk-color-palette-control', | ||
| position: 'left', | ||
| glowTarget: '.ugb-block-background-panel .block-editor-panel-color-gradient-settings__dropdown', | ||
| nextEventTarget: '.ugb-block-background-panel .block-editor-panel-color-gradient-settings__dropdown', | ||
| nextEvent: 'mousedown', | ||
| preStep: () => { | ||
| // Toggle background on | ||
| document.querySelector( '.ugb-block-background-panel:not(is-opened)' )?.click() | ||
| document.querySelector( '.ugb-block-background-panel .ugb-toggle-panel-form-toggle:not(is-checked) input' )?.click() | ||
| }, | ||
| postStep: () => { | ||
| // Click the tab | ||
| document.querySelector( '.ugb-block-background-panel .stk-color-palette-control .block-editor-panel-color-gradient-settings__dropdown:not(is-open)' )?.click() | ||
| }, | ||
| }, | ||
| { | ||
| title: __( 'Pick Your Brand Color', i18n ), | ||
| description: __( 'Select a color that matches your brand or mood. Try out different colors and instantly see the changes on your block.', i18n ), | ||
| help: createInterpolateElement( __( 'Choose a <strong>Color</strong> from the palette to apply it.', i18n ), { | ||
| strong: <strong />, | ||
| } ), | ||
| anchor: '.stk-color-palette-control__popover-content', | ||
| position: 'left', | ||
| glowTarget: '.stk-color-palette-control__popover-content', | ||
| nextEvent: 'mousedown', | ||
| nextEventTarget: '.stk-color-palette-control__popover-content *', | ||
| postStep: () => { | ||
| // Click the color picker | ||
| document.querySelector( '.ugb-block-background-panel .stk-color-palette-control .block-editor-panel-color-gradient-settings__dropdown.is-open' )?.click() | ||
| }, | ||
| }, | ||
| { | ||
| title: __( 'Add a Container for Better Layout', i18n ), | ||
| description: __( 'Turn on the Container option to give your columns content a background, padding, and improved alignment for a polished look.', i18n ), | ||
| help: createInterpolateElement( __( 'Toggle ON the <strong>Container</strong> to proceed.', i18n ), { | ||
| strong: <strong />, | ||
| } ), | ||
| anchor: '.ugb-panel--container-size .components-panel__body-title', | ||
| position: 'left', | ||
| glowTarget: '.ugb-panel--container-size .components-panel__body-title', | ||
| nextEventTarget: '.ugb-panel--container-size .components-panel__body-title input[type="checkbox"]', | ||
| nextEvent: 'mousedown', | ||
| preStep: () => { | ||
| // Click the tab | ||
| document.querySelector( '.ugb-block-background-panel .stk-color-palette-control .block-editor-panel-color-gradient-settings__dropdown.is-open' )?.click() | ||
|
|
||
| const allBlocks = select( 'core/block-editor' ).getBlocks() | ||
| const columnsBlock = allBlocks.find( block => block.name === 'stackable/columns' ) | ||
| if ( columnsBlock && columnsBlock.innerBlocks[ 0 ] ) { | ||
| dispatch( 'core/block-editor' ).selectBlock( columnsBlock.innerBlocks[ 0 ].clientId ) | ||
| document.querySelector( '.edit-post-sidebar__panel-tab.ugb-tab--layout:not(.is-active)' )?.click() | ||
| setTimeout( () => { | ||
| document.querySelector( '.ugb-panel--layout.is-opened .components-panel__body-title button' )?.click() | ||
| }, 100 ) | ||
| } | ||
| }, | ||
| }, | ||
| { | ||
| title: __( 'Block Backgrounds & Containers Recap', i18n ), | ||
| description: __( 'Great job! You\'ve learned how to add and customize block backgrounds and containers. These features are available in most Stackable blocks, helping you create beautiful, consistent layouts with ease.', i18n ), | ||
| preStep: () => { | ||
| // Toggle background on | ||
| document.querySelector( '.ugb-panel--container-size:not(is-opened)' )?.click() | ||
| document.querySelector( '.ugb-panel--container-size .ugb-toggle-panel-form-toggle:not(is-checked) input' )?.click() | ||
| }, | ||
| }, | ||
| { | ||
| title: __( 'Tip: Style All Blocks Efficiently', i18n ), | ||
| description: createInterpolateElement( __( 'Use the <strong>Stackable Design System</strong> to manage styles for all Stackable blocks globally. Perfect for a unified look and quick design changes!', i18n ), { | ||
| strong: <strong />, | ||
| } ), | ||
| anchor: '[aria-controls="stackable-global-settings:sidebar"]', | ||
| position: 'left-top', | ||
| offsetY: '-30px', | ||
| offsetX: '-8px', | ||
| glowTarget: '[aria-controls="stackable-global-settings:sidebar"]', | ||
| }, | ||
| ], | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.