Skip to content

Commit 859a38f

Browse files
authored
docs: Improve "Example not found" UI (#1342)
1 parent 375b120 commit 859a38f

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
import { useSetAtom } from 'jotai';
2-
import type { MouseEvent } from 'react';
32
import { currentExampleAtom } from '../utils/examples/currentExampleAtom.ts';
43
import useEvent from '../utils/useEvent.ts';
4+
import { Button } from './design/Button.tsx';
55

66
export function ExampleNotFound() {
77
const setCurrentExample = useSetAtom(currentExampleAtom);
88

9-
const handleGoHome = useEvent((e: MouseEvent) => {
10-
e.preventDefault();
11-
setCurrentExample(undefined);
12-
});
13-
149
return (
15-
<div className='flex flex-1 flex-col items-center justify-center'>
16-
<h1 className='font-bold text-4xl'>404 Example Not Found</h1>
17-
<button
18-
type='button'
19-
className='mt-4 text-lg text-slate-600 underline'
20-
onClick={handleGoHome}
10+
<div className='flex h-full flex-1 flex-col items-center justify-center gap-4'>
11+
<h1 className='font-bold text-3xl'>
12+
Example Not Found
13+
</h1>
14+
<Button
15+
accent
16+
onClick={useEvent(() => {
17+
setCurrentExample(undefined);
18+
})}
2119
>
22-
Go back home
23-
</button>
20+
Show default example
21+
</Button>
2422
</div>
2523
);
2624
}

0 commit comments

Comments
 (0)