Skip to content

Commit 167d7ce

Browse files
authored
Epic/error 화면 구현 (#65)
* 🎨 style : Error 페이지 구현 * ✨ feat : 버튼 클릭 시 토스트 알림 추가
1 parent 7862922 commit 167d7ce

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

src/pages/Error/index.jsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1-
const Error = () => <h1>에러 페이지입니다.</h1>;
1+
import { useState } from 'react';
2+
import { useNavigate } from 'react-router-dom';
3+
import imgLogo from 'assets/images/img_Logo.svg';
4+
5+
const Error = () => {
6+
const [showToast, setShowToast] = useState(false);
7+
const navigate = useNavigate();
8+
9+
const handleButtonClick = () => {
10+
setShowToast(true);
11+
12+
setTimeout(() => {
13+
navigate('/');
14+
}, 3000);
15+
};
16+
17+
return (
18+
<div className='relative flex flex-col items-center min-h-screen bg-gray-20'>
19+
<img src={imgLogo} alt='오픈마인드 로고' className='absolute w-[248px] h-[98px] mt-[80px] mx-auto mb-[24px] md:w-[456px] md:h-[180px] md:mt-[160px] opacity-30' />
20+
<div className='relative flex flex-col items-center max-w-[340px] mx-[20px] mt-[290px] p-[40px] rounded-lg bg-white shadow-lg z-10 md:w-[450px] md:mt-[360px]'>
21+
<p className='text-brown-50 text-4xl font-bold font-actor'>404</p>
22+
<p className='mt-[5px] mb-[20px] text-brown-40 text-lg'>페이지를 찾을 수 없어요</p>
23+
<button
24+
type='button'
25+
onClick={handleButtonClick}
26+
className='flex items-center justify-center w-[127px] h-[34px] px-3 py-2 rounded-md bg-brown-40 text-gray-10 text-sm md:w-[166px] md:h-[46px] md:gap-[8px] md:text-base transition-colors duration-300 hover:bg-brown-50'
27+
>
28+
처음으로 돌아가기
29+
</button>
30+
</div>
31+
32+
{showToast && (
33+
<div className='fixed bottom-[100px] md:bottom-[60px] left-1/2 px-5 py-3 bg-black rounded-lg text-sm/[18px] font-medium text-white -translate-x-1/2 shadow-2pt animate-slide-up-fade-delete'>
34+
홈으로 이동합니다.
35+
</div>
36+
)}
37+
</div>
38+
);
39+
};
240

341
export default Error;

0 commit comments

Comments
 (0)