Skip to content
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

Navigator: Replace deprecated NavigatorToParentButton with NavigatorBackButton #64775

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
__experimentalVStack as VStack,
__experimentalNavigatorProvider as NavigatorProvider,
__experimentalNavigatorScreen as NavigatorScreen,
__experimentalNavigatorToParentButton as NavigatorToParentButton,
__experimentalNavigatorBackButton as NavigatorBackButton,
__experimentalHeading as Heading,
Notice,
SelectControl,
Expand Down Expand Up @@ -382,7 +382,7 @@ function FontCollection( { slug } ) {

<NavigatorScreen path="/fontFamily">
<Flex justify="flex-start">
<NavigatorToParentButton
<NavigatorBackButton
icon={ chevronLeft }
size="small"
onClick={ () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
__experimentalHeading as Heading,
__experimentalNavigatorProvider as NavigatorProvider,
__experimentalNavigatorScreen as NavigatorScreen,
__experimentalNavigatorToParentButton as NavigatorToParentButton,
__experimentalNavigatorBackButton as NavigatorBackButton,
__experimentalUseNavigator as useNavigator,
__experimentalSpacer as Spacer,
__experimentalText as Text,
Expand Down Expand Up @@ -353,7 +353,7 @@ function InstalledFonts() {
/>

<Flex justify="flex-start">
<NavigatorToParentButton
<NavigatorBackButton
icon={ chevronLeft }
size="small"
onClick={ () => {
Expand Down
9 changes: 2 additions & 7 deletions packages/edit-site/src/components/global-styles/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
__experimentalSpacer as Spacer,
__experimentalHeading as Heading,
__experimentalView as View,
__experimentalNavigatorToParentButton as NavigatorToParentButton,
__experimentalNavigatorBackButton as NavigatorBackButton,
} from '@wordpress/components';
import { isRTL, __ } from '@wordpress/i18n';
import { chevronRight, chevronLeft } from '@wordpress/icons';
Expand All @@ -18,12 +18,7 @@ function ScreenHeader( { title, description, onBack } ) {
<View>
<Spacer marginBottom={ 0 } paddingX={ 4 } paddingY={ 3 }>
<HStack spacing={ 2 }>
<NavigatorToParentButton
style={
// TODO: This style override is also used in ToolsPanelHeader.
// It should be supported out-of-the-box by Button.
{ minWidth: 24, padding: 0 }
}
Comment on lines -22 to -26
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read this comment and it now looks like we can do without this override.

<NavigatorBackButton
icon={ isRTL() ? chevronRight : chevronLeft }
size="small"
label={ __( 'Back' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import {
__experimentalNavigatorButton as NavigatorButton,
__experimentalNavigatorToParentButton as NavigatorToParentButton,
__experimentalNavigatorBackButton as NavigatorBackButton,
__experimentalItem as Item,
FlexItem,
__experimentalHStack as HStack,
Expand Down Expand Up @@ -33,9 +33,7 @@ function NavigationButtonAsItem( props ) {
}

function NavigationBackButtonAsItem( props ) {
return (
<NavigatorToParentButton as={ GenericNavigationButton } { ...props } />
);
return <NavigatorBackButton as={ GenericNavigationButton } { ...props } />;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NavigationBackButtonAsItem component doesn't seem to be used anywhere in Gutenberg.

}

export { NavigationButtonAsItem, NavigationBackButtonAsItem };
Loading