@@ -67,6 +67,11 @@ interface ContextScreensProps {
6767 parentMenu ?: string ;
6868}
6969
70+ interface GlobalStylesNavigationScreenProps {
71+ path : string ;
72+ children : React . ReactNode ;
73+ }
74+
7075function ContextScreens ( { name, parentMenu = '' } : ContextScreensProps ) {
7176 const blockStyleVariations = useSelect (
7277 ( select ) => {
@@ -81,9 +86,11 @@ function ContextScreens( { name, parentMenu = '' }: ContextScreensProps ) {
8186
8287 return (
8388 < >
84- < Navigator . Screen path = { parentMenu + '/colors/palette' } >
89+ < GlobalStylesNavigationScreen
90+ path = { parentMenu + '/colors/palette' }
91+ >
8592 < ScreenColorPalette name = { name } />
86- </ Navigator . Screen >
93+ </ GlobalStylesNavigationScreen >
8794
8895 { ! ! blockStyleVariations ?. length && (
8996 < BlockStylesNavigationScreens
@@ -165,72 +172,72 @@ export function GlobalStylesUI( {
165172 onPathChange = { onPathChange }
166173 />
167174 ) }
168- < Navigator . Screen path = "/" >
175+ < GlobalStylesNavigationScreen path = "/" >
169176 < ScreenRoot />
170- </ Navigator . Screen >
171- < Navigator . Screen path = "/colors" >
177+ </ GlobalStylesNavigationScreen >
178+ < GlobalStylesNavigationScreen path = "/colors" >
172179 < ScreenColors />
173- </ Navigator . Screen >
174- < Navigator . Screen path = "/typography" >
180+ </ GlobalStylesNavigationScreen >
181+ < GlobalStylesNavigationScreen path = "/typography" >
175182 < ScreenTypography />
176- </ Navigator . Screen >
177- < Navigator . Screen path = "/typography/font-sizes" >
183+ </ GlobalStylesNavigationScreen >
184+ < GlobalStylesNavigationScreen path = "/typography/font-sizes" >
178185 < FontSizes />
179- </ Navigator . Screen >
180- < Navigator . Screen path = "/typography/font-sizes/:origin/:slug" >
186+ </ GlobalStylesNavigationScreen >
187+ < GlobalStylesNavigationScreen path = "/typography/font-sizes/:origin/:slug" >
181188 < FontSize />
182- </ Navigator . Screen >
183- < Navigator . Screen path = "/layout" >
189+ </ GlobalStylesNavigationScreen >
190+ < GlobalStylesNavigationScreen path = "/layout" >
184191 < ScreenLayout />
185- </ Navigator . Screen >
186- < Navigator . Screen path = "/colors/palette" >
192+ </ GlobalStylesNavigationScreen >
193+ < GlobalStylesNavigationScreen path = "/colors/palette" >
187194 < ScreenColorPalette />
188- </ Navigator . Screen >
189- < Navigator . Screen path = "/variations" >
195+ </ GlobalStylesNavigationScreen >
196+ < GlobalStylesNavigationScreen path = "/variations" >
190197 < ScreenStyleVariations />
191- </ Navigator . Screen >
192- < Navigator . Screen path = "/css" >
198+ </ GlobalStylesNavigationScreen >
199+ < GlobalStylesNavigationScreen path = "/css" >
193200 < ScreenCSS />
194- </ Navigator . Screen >
195- < Navigator . Screen path = "/revisions/:revisionId?" >
201+ </ GlobalStylesNavigationScreen >
202+ < GlobalStylesNavigationScreen path = "/revisions/:revisionId?" >
196203 < ScreenRevisions />
197- </ Navigator . Screen >
198- < Navigator . Screen path = "/shadows" >
204+ </ GlobalStylesNavigationScreen >
205+ < GlobalStylesNavigationScreen path = "/shadows" >
199206 < ScreenShadows />
200- </ Navigator . Screen >
201- < Navigator . Screen path = "/shadows/edit/:category/:slug" >
207+ </ GlobalStylesNavigationScreen >
208+ < GlobalStylesNavigationScreen path = "/shadows/edit/:category/:slug" >
202209 < ScreenShadowsEdit />
203- </ Navigator . Screen >
204- < Navigator . Screen path = "/background" >
210+ </ GlobalStylesNavigationScreen >
211+ < GlobalStylesNavigationScreen path = "/background" >
205212 < ScreenBackground />
206- </ Navigator . Screen >
207- < Navigator . Screen path = "/typography/text" >
213+ </ GlobalStylesNavigationScreen >
214+ < GlobalStylesNavigationScreen path = "/typography/text" >
208215 < ScreenTypographyElement element = "text" />
209- </ Navigator . Screen >
210- < Navigator . Screen path = "/typography/link" >
216+ </ GlobalStylesNavigationScreen >
217+ < GlobalStylesNavigationScreen path = "/typography/link" >
211218 < ScreenTypographyElement element = "link" />
212- </ Navigator . Screen >
213- < Navigator . Screen path = "/typography/heading" >
219+ </ GlobalStylesNavigationScreen >
220+ < GlobalStylesNavigationScreen path = "/typography/heading" >
214221 < ScreenTypographyElement element = "heading" />
215- </ Navigator . Screen >
216- < Navigator . Screen path = "/typography/caption" >
222+ </ GlobalStylesNavigationScreen >
223+ < GlobalStylesNavigationScreen path = "/typography/caption" >
217224 < ScreenTypographyElement element = "caption" />
218- </ Navigator . Screen >
219- < Navigator . Screen path = "/typography/button" >
225+ </ GlobalStylesNavigationScreen >
226+ < GlobalStylesNavigationScreen path = "/typography/button" >
220227 < ScreenTypographyElement element = "button" />
221- </ Navigator . Screen >
222- < Navigator . Screen path = "/blocks" >
228+ </ GlobalStylesNavigationScreen >
229+ < GlobalStylesNavigationScreen path = "/blocks" >
223230 < ScreenBlockList />
224- </ Navigator . Screen >
231+ </ GlobalStylesNavigationScreen >
225232 { blocks . map ( ( block : BlockType ) => (
226- < Navigator . Screen
233+ < GlobalStylesNavigationScreen
227234 key = { 'menu-block-' + block . name }
228235 path = {
229236 '/blocks/' + encodeURIComponent ( block . name )
230237 }
231238 >
232239 < ScreenBlock name = { block . name } />
233- </ Navigator . Screen >
240+ </ GlobalStylesNavigationScreen >
234241 ) ) }
235242
236243 < ContextScreens />
@@ -250,6 +257,20 @@ export function GlobalStylesUI( {
250257 ) ;
251258}
252259
260+ function GlobalStylesNavigationScreen ( {
261+ path,
262+ children,
263+ } : GlobalStylesNavigationScreenProps ) {
264+ return (
265+ < Navigator . Screen
266+ className = "global-styles-ui-sidebar__navigator-screen"
267+ path = { path }
268+ >
269+ { children }
270+ </ Navigator . Screen >
271+ ) ;
272+ }
273+
253274/*
254275 * Component that handles path synchronization between external path prop and Navigator's internal path.
255276 */
0 commit comments