@@ -20,7 +20,14 @@ export const designLibrary = {
2020 } ) ,
2121 size : 'medium' ,
2222 nextEventTarget : '.ugb-design-library-item' ,
23+ nextEvent : 'mousedown' ,
2324 offsetX : '-400px' ,
25+ postStep : ( ) => {
26+ // Make sure the first one (or at least there is one) that's toggled
27+ if ( ! document . querySelector ( '.ugb-design-library-item.ugb--is-toggled' ) ) {
28+ document . querySelector ( '.ugb-design-library-item' ) ?. click ( )
29+ }
30+ } ,
2431 } ,
2532 {
2633 title : __ ( 'Pick Styling Options' , i18n ) ,
@@ -63,15 +70,56 @@ export const designLibrary = {
6370 } ,
6471 {
6572 title : __ ( 'Patterns and Full-Pages' , i18n ) ,
66- description : __ ( 'Great! Your entire library is now styled. Aside from patterns, there are also full-page layouts in the library .' , i18n ) ,
67- help : createInterpolateElement ( __ ( 'Click the <strong>Pages </strong> tab to continue.' , i18n ) , {
73+ description : __ ( 'Great! Your entire library is now styled. Aside from patterns, Stackable also provides you with full-page layouts.' , i18n ) ,
74+ help : createInterpolateElement ( __ ( 'Click the <strong>Next </strong> to continue.' , i18n ) , {
6875 strong : < strong /> ,
6976 } ) ,
70- // TODO: Change these when we have the pages tab already.
71- anchor : '.ugb-modal-design-library .components-modal__header' ,
77+ anchor : '.stk-design-library-tabs .components-button-group' ,
7278 position : 'bottom' ,
73- nextEventTarget : '.ugb-modal-design-library .components-modal__header' ,
74- glowTarget : '.ugb-modal-design-library .components-modal__header' ,
79+ nextEventTarget : '.stk-design-library-tabs .components-button-group' ,
80+ glowTarget : '.stk-design-library-tabs .components-button-group' ,
81+ preStep : ( ) => {
82+ // Disable for now the pages tab
83+ const pagesButton = document . querySelector ( '.stk-design-library-tabs button[value="pages"]' )
84+ if ( pagesButton ) {
85+ pagesButton . disabled = true
86+ }
87+ } ,
88+ postStep : ( ) => {
89+ // Enable the pages tab
90+ const pagesButton = document . querySelector ( '.stk-design-library-tabs button[value="pages"]' )
91+ if ( pagesButton ) {
92+ pagesButton . disabled = false
93+ }
94+ } ,
95+ } ,
96+ {
97+ title : __ ( 'Let\'s Insert Our Pattern' , i18n ) ,
98+ description : __ ( 'Now let\'s insert our pattern into our page.' , i18n ) ,
99+ help : createInterpolateElement ( __ ( 'Click on <strong>Add Designs</strong> to continue.' , i18n ) , {
100+ strong : < strong /> ,
101+ } ) ,
102+ anchor : '.ugb-modal-design-library__add-multi' ,
103+ position : 'top-right' ,
104+ nextEventTarget : '.ugb-modal-design-library__add-multi' ,
105+ glowTarget : '.ugb-modal-design-library__add-multi' ,
106+ preStep : ( ) => {
107+ // Make sure the patterns tab is selected
108+ document . querySelector ( '.ugb-modal-design-library button[value="patterns"]:not(.is-primary)' ) ?. click ( )
109+
110+ // Make sure the first one (or at least there is one) that's toggled
111+ if ( ! document . querySelector ( '.ugb-design-library-item.ugb--is-toggled' ) ) {
112+ document . querySelector ( '.ugb-design-library-item' ) ?. click ( )
113+ }
114+ } ,
115+ postStep : ( ) => {
116+ setTimeout ( ( ) => {
117+ // If the design library is still open, click the add button.
118+ if ( document . querySelector ( '.ugb-modal-design-library' ) ) {
119+ document . querySelector ( '.ugb-modal-design-library__add-multi' ) ?. click ( )
120+ }
121+ } , 100 )
122+ } ,
75123 } ,
76124 ] ,
77125}
0 commit comments