-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): error, global error, not found page
- Loading branch information
Showing
5 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use client'; | ||
|
||
import BasketImage from '@/assets/images/basket.webp'; | ||
import { Asset, Button, Header, Layout, Paragraph, spacings } from '@bottlesteam/ui'; | ||
import Image from 'next/image'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useEffect } from 'react'; | ||
import { errorImageContainer } from './layout.css'; | ||
|
||
interface ErrorPageProps { | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
} | ||
|
||
export default function DefaultErrorPage({ error, reset }: ErrorPageProps) { | ||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
// Log error | ||
console.error(error); | ||
}, [error]); | ||
|
||
return ( | ||
<> | ||
<Header> | ||
<button | ||
onClick={() => router.back()} | ||
// onClick={() => send({ type: AppBridgeMessageType.WEB_VIEW_CLOSE })} | ||
style={{ background: 'none', border: 'none' }} | ||
> | ||
<Asset type="icon-arrow-left" /> | ||
</button> | ||
</Header> | ||
<Layout.Contents> | ||
<Paragraph typography="t2" color="black100" style={{ marginTop: spacings.xl, marginBottom: spacings.xxl }}> | ||
{'앗, 오류가 발생했어요!\n보틀을 다시 실행해 주세요'} | ||
</Paragraph> | ||
<div className={errorImageContainer}> | ||
<Image alt="basket" src={BasketImage} width={250} height={250} /> | ||
<Button variant="solid" size="sm" onClick={reset}> | ||
다시 시도하기 | ||
</Button> | ||
</div> | ||
</Layout.Contents> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use client'; | ||
|
||
export default function GlobalError({ reset }: { error: Error & { digest?: string }; reset: () => void }) { | ||
return ( | ||
<html> | ||
<body> | ||
<h2>Something went wrong!</h2> | ||
<button onClick={() => reset()}>Try again</button> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use client'; | ||
|
||
import BasketImage from '@/assets/images/basket.webp'; | ||
import { Asset, Button, Layout, Paragraph, spacings, Header } from '@bottlesteam/ui'; | ||
import Image from 'next/image'; | ||
import { useRouter } from 'next/navigation'; | ||
import { errorImageContainer } from './layout.css'; | ||
|
||
export default function DefaultErrorPage() { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<> | ||
<Header> | ||
<button onClick={router.back} style={{ background: 'none', border: 'none' }}> | ||
<Asset type="icon-arrow-left" /> | ||
</button> | ||
</Header> | ||
<Layout.Contents> | ||
<Paragraph typography="t2" color="black100" style={{ marginTop: spacings.xl, marginBottom: spacings.xxl }}> | ||
{'앗, 오류가 발생했어요!\n존재하지 않는 페이지에요.'} | ||
</Paragraph> | ||
<div className={errorImageContainer}> | ||
<Image alt="basket" src={BasketImage} width={250} height={250} /> | ||
<Button variant="solid" size="sm" onClick={router.back}> | ||
돌아가기 | ||
</Button> | ||
</div> | ||
</Layout.Contents> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters