Skip to content

Commit 5f9a142

Browse files
committed
Upgrade react-collapse and fix design of scoped not found pages
1 parent 37804ab commit 5f9a142

6 files changed

Lines changed: 56 additions & 24 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"parse-numeric-range": "^1.2.0",
4141
"raw-loader": "^4.0.2",
4242
"react": "19.2.7",
43-
"react-collapsed": "4.0.4",
43+
"react-collapsed": "^4.2.0",
4444
"react-dom": "19.2.7",
4545
"remark-frontmatter": "^4.0.1",
4646
"remark-gfm": "^3.0.1"

src/app/community/not-found.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import sidebarCommunity from '../../sidebarCommunity.json';
89
import {NotFoundContent} from 'components/Layout/NotFoundContent';
10+
import type {RouteItem} from 'components/Layout/getRouteMeta';
911

1012
export default function NotFound() {
11-
return <NotFoundContent />;
13+
return (
14+
<NotFoundContent
15+
routeTree={sidebarCommunity as RouteItem}
16+
sectionPath="/community"
17+
/>
18+
);
1219
}

src/app/learn/not-found.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import sidebarLearn from '../../sidebarLearn.json';
89
import {NotFoundContent} from 'components/Layout/NotFoundContent';
10+
import type {RouteItem} from 'components/Layout/getRouteMeta';
911

1012
export default function NotFound() {
11-
return <NotFoundContent />;
13+
return (
14+
<NotFoundContent
15+
routeTree={sidebarLearn as RouteItem}
16+
sectionPath="/learn"
17+
/>
18+
);
1219
}

src/app/reference/not-found.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import sidebarReference from '../../sidebarReference.json';
89
import {NotFoundContent} from 'components/Layout/NotFoundContent';
10+
import type {RouteItem} from 'components/Layout/getRouteMeta';
911

1012
export default function NotFound() {
11-
return <NotFoundContent />;
13+
return (
14+
<NotFoundContent
15+
routeTree={sidebarReference as RouteItem}
16+
sectionPath="/reference"
17+
/>
18+
);
1219
}

src/components/Layout/NotFoundContent.tsx

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,40 @@
77

88
'use client';
99

10-
import {MDXComponents} from 'components/MDX/MDXComponents';
10+
import PageHeading from 'components/PageHeading';
11+
import Intro from 'components/MDX/Intro';
12+
import Link from 'components/MDX/Link';
13+
import {getRouteMeta} from './getRouteMeta';
14+
import type {RouteItem} from './getRouteMeta';
1115

12-
const {Intro, MaxWidth, p: P, a: A} = MDXComponents;
13-
14-
export function NotFoundContent() {
16+
export function NotFoundContent({
17+
routeTree,
18+
sectionPath,
19+
}: {
20+
routeTree: RouteItem;
21+
sectionPath: string;
22+
}) {
23+
const {breadcrumbs} = getRouteMeta(sectionPath, routeTree);
1524
return (
1625
<main className="min-w-0 isolate">
1726
<article className="font-normal break-words text-primary dark:text-primary-dark">
18-
<div className="px-5 sm:px-12">
19-
<div className="max-w-7xl mx-auto">
20-
<MaxWidth>
27+
<div className="ps-0">
28+
<div>
29+
<PageHeading title="Not Found" breadcrumbs={breadcrumbs} />
30+
</div>
31+
<div className="px-5 sm:px-12">
32+
<div className="max-w-7xl mx-auto">
2133
<Intro>
22-
<P>This page doesn’t exist.</P>
23-
<P>
24-
If this is a mistake{', '}
25-
<A href="https://github.com/reactjs/react.dev/issues/new">
34+
<p>This page doesn’t exist.</p>
35+
<p>
36+
If this is a mistake,{' '}
37+
<Link href="https://github.com/reactjs/react.dev/issues/new">
2638
let us know
27-
</A>
28-
{', '}
29-
and we will try to fix it!
30-
</P>
39+
</Link>
40+
, and we will try to fix it!
41+
</p>
3142
</Intro>
32-
</MaxWidth>
43+
</div>
3344
</div>
3445
</div>
3546
</article>

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7586,10 +7586,10 @@ raw-loader@^4.0.2:
75867586
loader-utils "^2.0.0"
75877587
schema-utils "^3.0.0"
75887588

7589-
react-collapsed@4.0.4:
7590-
version "4.0.4"
7591-
resolved "https://registry.npmjs.org/react-collapsed/-/react-collapsed-4.0.4.tgz"
7592-
integrity sha512-8avvmnQxDYTgGZYVP9+3Z7doomxVEBoCkukpTmUHEIrAYvELZ5jNNfYCt/hCpHB6GmQbzZoDmnDupjsnQVgcCQ==
7589+
react-collapsed@^4.2.0:
7590+
version "4.2.0"
7591+
resolved "https://registry.yarnpkg.com/react-collapsed/-/react-collapsed-4.2.0.tgz#330613bd604e1d8b66832d931efb2b226925cbc0"
7592+
integrity sha512-8rQuV3wGTjBI4M1WzD5DpqCBRliHNDKEEFeC6tAQEVrRDic46xBOtySgMGjVVacIobEaMf7AiYlI5APCZIZtkg==
75937593
dependencies:
75947594
tiny-warning "^1.0.3"
75957595

0 commit comments

Comments
 (0)