diff --git a/packages/global-styles-ui/src/global-styles-ui.tsx b/packages/global-styles-ui/src/global-styles-ui.tsx index 8d54553d23dda2..37a7069bb9f2c4 100644 --- a/packages/global-styles-ui/src/global-styles-ui.tsx +++ b/packages/global-styles-ui/src/global-styles-ui.tsx @@ -67,6 +67,11 @@ interface ContextScreensProps { parentMenu?: string; } +interface GlobalStylesNavigationScreenProps { + path: string; + children: React.ReactNode; +} + function ContextScreens( { name, parentMenu = '' }: ContextScreensProps ) { const blockStyleVariations = useSelect( ( select ) => { @@ -81,9 +86,11 @@ function ContextScreens( { name, parentMenu = '' }: ContextScreensProps ) { return ( <> - + - + { !! blockStyleVariations?.length && ( ) } - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + { blocks.map( ( block: BlockType ) => ( - - + ) ) } @@ -250,6 +257,20 @@ export function GlobalStylesUI( { ); } +function GlobalStylesNavigationScreen( { + path, + children, +}: GlobalStylesNavigationScreenProps ) { + return ( + + { children } + + ); +} + /* * Component that handles path synchronization between external path prop and Navigator's internal path. */ diff --git a/packages/global-styles-ui/src/screen-css.tsx b/packages/global-styles-ui/src/screen-css.tsx index 6dbe6b97e0faf4..3e127dcd9ffaed 100644 --- a/packages/global-styles-ui/src/screen-css.tsx +++ b/packages/global-styles-ui/src/screen-css.tsx @@ -17,10 +17,6 @@ import { unlock } from './lock-unlock'; const { AdvancedPanel: StylesAdvancedPanel } = unlock( blockEditorPrivateApis ); function ScreenCSS() { - const description = __( - 'Add your own CSS to customize the appearance and layout of your site.' - ); - // Get user-only styles (should not decode/encode to preserve raw CSS) const [ style ] = useStyle( '', undefined, 'user', false ); // Get all styles (inherited + user) for context @@ -33,16 +29,26 @@ function ScreenCSS() { return ( <> - + + { __( + 'You can add custom CSS to further customize the appearance and layout of your site.' + ) } +
+ + { __( 'Learn more about CSS' ) } + + + } + />
- - { __( 'Learn more about CSS' ) } - { - const { - __experimentalGetCurrentThemeGlobalStylesVariations, - __experimentalGetCurrentGlobalStylesId, - getEntityRecord, - } = select( coreStore ); - - const globalStylesId = __experimentalGetCurrentGlobalStylesId(); - const globalStyles = globalStylesId - ? getEntityRecord( 'root', 'globalStyles', globalStylesId ) - : undefined; - - return { - hasVariations: - !! __experimentalGetCurrentThemeGlobalStylesVariations() - ?.length, - canEditCSS: !! ( globalStyles as GlobalStylesConfig )?._links?.[ - 'wp:action-edit-css' - ], - }; + const hasVariations = useSelect( ( select ) => { + const { __experimentalGetCurrentThemeGlobalStylesVariations } = + select( coreStore ); + return !! __experimentalGetCurrentThemeGlobalStylesVariations()?.length; }, [] ); return ( @@ -107,38 +90,6 @@ function ScreenRoot() { - - { canEditCSS && ( - <> - - - - { __( - 'Add your own CSS to customize the appearance and layout of your site.' - ) } - - - - - - { __( 'Additional CSS' ) } - - - - - - - - ) } ); }