Skip to content

Commit

Permalink
Update 404 notice implementation with reusable component
Browse files Browse the repository at this point in the history
  • Loading branch information
Infinite-Null committed Feb 20, 2025
1 parent 3c4f9a3 commit f04a461
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 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
36 changes: 15 additions & 21 deletions packages/edit-site/src/components/site-editor-routes/notfound.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,33 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { Notice } from '@wordpress/components';
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={
<Notice
status="error"
isDismissible={ false }
className="edit-site-layout__area__404"
>
{ __(
'The requested page could not be found. Please check the URL.'
) }
</Notice>
}
customDescription={ <NotFoundError /> }
/>
),
content: (
<Notice
status="error"
isDismissible={ false }
className="edit-site-layout__area__404"
>
{ __(
'The requested page could not be found. Please check the URL.'
) }
</Notice>
<Spacer padding={ 2 }>
<NotFoundError />
</Spacer>
),
},
};

0 comments on commit f04a461

Please sign in to comment.