Skip to content

Commit

Permalink
Enhance 404 message styling (#69234)
Browse files Browse the repository at this point in the history
* Enhance 404 message styling with Notice component

* Improve 404 error message

* Remove color style from `.edit-site-layout__area__404`

* Update 404 notice implementation with reusable component

* Fixed DOM nesting validation error by replacing p with div

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: joedolson <joedolson@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
  • Loading branch information
5 people authored Feb 20, 2025
1 parent 1756bac commit 0f7193c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 0 additions & 4 deletions packages/edit-site/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
}
}

.edit-site-layout__area__404 {
margin: $canvas-padding;
}

.edit-site .components-editor-notices__snackbar {
position: fixed;
right: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ export default function SidebarNavigationScreen( {
</HStack>
<div className="edit-site-sidebar-navigation-screen__content">
{ description && (
<p className="edit-site-sidebar-navigation-screen__description">
<div className="edit-site-sidebar-navigation-screen__description">
{ description }
</p>
</div>
) }
{ content }
</div>
Expand Down
19 changes: 15 additions & 4 deletions packages/edit-site/src/components/site-editor-routes/notfound.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,33 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { Notice, __experimentalSpacer as Spacer } from '@wordpress/components';
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';

function NotFoundError() {
return (
<Notice status="error" isDismissible={ false }>
{ __(
'The requested page could not be found. Please check the URL.'
) }
</Notice>
);
}

export const notFoundRoute = {
name: 'notfound',
path: '*',
areas: {
sidebar: <SidebarNavigationScreenMain />,
mobile: (
<SidebarNavigationScreenMain
customDescription={ __( '404 (Not Found)' ) }
customDescription={ <NotFoundError /> }
/>
),
content: (
<p className="edit-site-layout__area__404">
{ __( '404 (Not Found)' ) }
</p>
<Spacer padding={ 2 }>
<NotFoundError />
</Spacer>
),
},
};

0 comments on commit 0f7193c

Please sign in to comment.