diff --git a/packages/edit-post/src/components/preferences-modal/index.js b/packages/edit-post/src/components/preferences-modal/index.js index ccd323f338038..09c36c7bd2875 100644 --- a/packages/edit-post/src/components/preferences-modal/index.js +++ b/packages/edit-post/src/components/preferences-modal/index.js @@ -55,19 +55,14 @@ import BlockManager from '../block-manager'; const MODAL_NAME = 'edit-post/preferences'; const PREFERENCES_MENU = 'preferences-menu'; -function NavigationButton( { - as: Tag = Button, - path, - isBack = false, - ...props -} ) { - const navigator = useNavigator(); - return ( - navigator.push( path, { isBack } ) } - { ...props } - /> - ); +function NavigationButton( { as: Tag = Button, path, ...props } ) { + const { push } = useNavigator(); + return push( path ) } { ...props } />; +} + +function NavigationBackButton( { as: Tag = Button, ...props } ) { + const { pop } = useNavigator(); + return ; } export default function PreferencesModal() { @@ -376,12 +371,10 @@ export default function PreferencesModal() { size="small" gap="6" > - - } size="small" - isBack aria-label={ __( 'Navigate to the previous view' ) } /> diff --git a/packages/edit-site/src/components/global-styles/navigation-button.js b/packages/edit-site/src/components/global-styles/navigation-button.js index c891a79302b4b..72545c80e4832 100644 --- a/packages/edit-site/src/components/global-styles/navigation-button.js +++ b/packages/edit-site/src/components/global-styles/navigation-button.js @@ -9,16 +9,9 @@ import { } from '@wordpress/components'; import { Icon } from '@wordpress/icons'; -function NavigationButton( { - path, - icon, - children, - isBack = false, - ...props -} ) { - const navigator = useNavigator(); +function GenericNavigationButton( { icon, children, ...props } ) { return ( - navigator.push( path, { isBack } ) } { ...props }> + { icon && ( @@ -31,5 +24,16 @@ function NavigationButton( { ); } +function NavigationButton( { path, ...props } ) { + const { push } = useNavigator(); + return ( + push( path ) } { ...props } /> + ); +} + +function NavigationBackButton( { ...props } ) { + const { pop } = useNavigator(); + return ; +} -export default NavigationButton; +export { NavigationButton, NavigationBackButton }; diff --git a/packages/edit-site/src/components/global-styles/palette.js b/packages/edit-site/src/components/global-styles/palette.js index 10fb3cbb04802..5a2385b3289dc 100644 --- a/packages/edit-site/src/components/global-styles/palette.js +++ b/packages/edit-site/src/components/global-styles/palette.js @@ -17,7 +17,7 @@ import { useMemo } from '@wordpress/element'; * Internal dependencies */ import Subtitle from './subtitle'; -import NavigationButton from './navigation-button'; +import { NavigationButton } from './navigation-button'; import { useSetting } from './hooks'; const EMPTY_COLORS = []; diff --git a/packages/edit-site/src/components/global-styles/screen-background-color.js b/packages/edit-site/src/components/global-styles/screen-background-color.js index d8328a16586d1..b35b64d03b124 100644 --- a/packages/edit-site/src/components/global-styles/screen-background-color.js +++ b/packages/edit-site/src/components/global-styles/screen-background-color.js @@ -17,7 +17,6 @@ import { } from './hooks'; function ScreenBackgroundColor( { name } ) { - const parentMenu = name === undefined ? '' : '/blocks/' + name; const supports = getSupportedGlobalStylesPanels( name ); const [ solids ] = useSetting( 'color.palette', name ); const [ gradients ] = useSetting( 'color.gradients', name ); @@ -86,7 +85,6 @@ function ScreenBackgroundColor( { name } ) { return ( <> - + ); diff --git a/packages/edit-site/src/components/global-styles/screen-color-palette.js b/packages/edit-site/src/components/global-styles/screen-color-palette.js index 033d6427b7d2f..554c16cbb83c1 100644 --- a/packages/edit-site/src/components/global-styles/screen-color-palette.js +++ b/packages/edit-site/src/components/global-styles/screen-color-palette.js @@ -17,12 +17,10 @@ import ScreenHeader from './header'; function ScreenColorPalette( { name } ) { const [ currentTab, setCurrentTab ] = useState( 'solid' ); - const parentMenu = name === undefined ? '' : '/blocks/' + name; return ( <> - + { hasDimensionsPanel && } { hasBorderPanel && } diff --git a/packages/edit-site/src/components/global-styles/screen-link-color.js b/packages/edit-site/src/components/global-styles/screen-link-color.js index 6d033a77f2ecd..d939bf000ef9e 100644 --- a/packages/edit-site/src/components/global-styles/screen-link-color.js +++ b/packages/edit-site/src/components/global-styles/screen-link-color.js @@ -16,7 +16,6 @@ import { } from './hooks'; function ScreenLinkColor( { name } ) { - const parentMenu = name === undefined ? '' : '/blocks/' + name; const supports = getSupportedGlobalStylesPanels( name ); const [ solids ] = useSetting( 'color.palette', name ); const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name ); @@ -47,7 +46,6 @@ function ScreenLinkColor( { name } ) { return ( <> diff --git a/packages/edit-site/src/components/global-styles/screen-typography.js b/packages/edit-site/src/components/global-styles/screen-typography.js index b2fe028c2de54..d3b3cada3c680 100644 --- a/packages/edit-site/src/components/global-styles/screen-typography.js +++ b/packages/edit-site/src/components/global-styles/screen-typography.js @@ -13,7 +13,7 @@ import { * Internal dependencies */ import ScreenHeader from './header'; -import NavigationButton from './navigation-button'; +import { NavigationButton } from './navigation-button'; import { useStyle } from './hooks'; import Subtitle from './subtitle'; import TypographyPanel from './typography-panel'; @@ -72,7 +72,6 @@ function ScreenTypography( { name } ) { return ( <> ) } - { /* no typogrpahy elements support yet for blocks */ } + { /* no typography elements support yet for blocks */ } { !! name && } );