Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Feat: NotFound 페이지 구현 #50

Merged
merged 4 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/assets/images/aespa.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/nctdream.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/newjeans.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/seventeen.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions src/pages/NotFoundPage/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useNavigate } from 'react-router-dom';
import CustomButton from '@/components/CustomButton';
import Logo from '@/assets/icons/Logo';
import Idol1 from '@/assets/images/nctdream.jpg';
import Idol2 from '@/assets/images/newjeans.jpg';
import Idol3 from '@/assets/images/seventeen.jpg';
import Idol4 from '@/assets/images/aespa.jpg';
import style from './styles.module.scss';

const NotFoundPage = () => {
const navigate = useNavigate();

const idolList = [Idol1, Idol2, Idol3, Idol4];

const getRandomImage = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

랜덤으로 이미지 생성하셨네요 진짜 좋은 것 같습니다

const randomIndex = Math.floor(Math.random() * idolList.length);
return idolList[randomIndex];
};

const randomImage = getRandomImage();

return (
<div className={style.container}>
<div className={style.logo}>
<img src={randomImage} alt="아이돌 이미지" />
<div />
<Logo width={240} height={50} />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 이렇게 중간에 <div /> 넣어줘서 하는 거군요. ㅇㅎㅇㅎ

<div className={style.text}>
<h3>잘못된 경로</h3>
<p>존재하지 않는 페이지입니다.</p>
</div>
<CustomButton
rounded
btnText="랜딩 페이지로"
onClick={() => navigate('/')}
/>
</div>
);
};

export default NotFoundPage;
69 changes: 69 additions & 0 deletions src/pages/NotFoundPage/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@import '../../styles/';

.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;

background-color: black;
color: white;

height: 100vh;
padding-block: 10vh;

button {
width: 300px;
}
}

.logo {
display: flex;
flex-direction: column;
align-items: center;

position: relative;

margin-top: 5px;

img {
width: 350px;
height: 350px;

opacity: 70%;
}

div {
position: absolute;

width: 365px;
height: 365px;

background: radial-gradient(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 거는 어떻게 작성하는 거죠... 뭐 꿀팁 있나요. 계산하는 사이트라던지 ㅎㅎ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

피그마에서 복사하기 누른거예요ㅋㅋㅋ

50% 50% at 50% 50%,
rgba(2, 0, 14, 0) 0%,
rgba(2, 0, 14, 0.180099) 37.5%,
rgba(2, 0, 14, 0.5) 79.5%,
#02000e 100%
);
}

svg {
position: absolute;
top: 5px;
opacity: 80%;
}
}

.text {
text-align: center;

h3 {
@include font-base($color-white, 700, 26px, 26px);
margin-block: 10px;
}

p {
@include font-base($color-gray-cool-100, 400, 16px, 26px);
}
}
3 changes: 2 additions & 1 deletion src/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import LadingPage from './pages/LandingPage';
import ListPage from './pages/ListPage';
import MyPage from './pages/MyPage';
import TestPage from './pages/TestPage';
import NotFoundPage from './pages/NotFoundPage';

const router = createBrowserRouter([
{
Expand All @@ -24,7 +25,7 @@ const router = createBrowserRouter([
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

라우터에서는 이렇게 하는군요. 배워갑니다

path: '*',
element: <p>존재하지 않는 페이지입니다.</p>,
element: <NotFoundPage />,
},
]);

Expand Down