|
| 1 | +import React, { useEffect } from "react"; |
| 2 | +import { useNavigate } from "react-router"; |
| 3 | +import { PrimaryButton } from "../components/button/button"; |
| 4 | +import BUTTON_SIZE from "../components/button/button-size"; |
| 5 | +import styled from "styled-components"; |
| 6 | +import CrushedPaperPlane from "../assets/ic-paperairplane.svg"; |
| 7 | +import logoImage from "../assets/logo.svg"; |
| 8 | +import { media } from "../utils/media"; |
| 9 | + |
| 10 | +const TopContainer = styled.article` |
| 11 | + height: 100vh; |
| 12 | + border: 1px solid #ff000021; |
| 13 | + display: flex; |
| 14 | + font-size: 80px; |
| 15 | + justify-content: center; |
| 16 | + align-items: center; |
| 17 | + flex-direction: column; |
| 18 | +`; |
| 19 | + |
| 20 | +const ContentsContainer = styled.section` |
| 21 | + &::before { |
| 22 | + content: ""; |
| 23 | + position: absolute; |
| 24 | + inset: 0; |
| 25 | + background: url(${CrushedPaperPlane}) center/cover repeat; |
| 26 | + background-size: 250px; |
| 27 | + opacity: 0.15; |
| 28 | + z-index: 0; |
| 29 | + } |
| 30 | +
|
| 31 | + > * { |
| 32 | + position: relative; |
| 33 | + z-index: 1; |
| 34 | + } |
| 35 | +`; |
| 36 | + |
| 37 | +const Contents = styled.article` |
| 38 | + text-align: center; |
| 39 | + display: flex; |
| 40 | + flex-direction: column; |
| 41 | + align-items: center; |
| 42 | +`; |
| 43 | + |
| 44 | +const ErrorNumber = styled.h1` |
| 45 | + font-weight: 900; |
| 46 | + color: var(--color-purple-700); |
| 47 | + margin: 0; |
| 48 | + font-size: 200px; |
| 49 | +
|
| 50 | + ${media.mobile} { |
| 51 | + font-size: 130px; |
| 52 | + } |
| 53 | +`; |
| 54 | + |
| 55 | +const ErrorComment = styled.span` |
| 56 | + font-size: 80px; |
| 57 | + color: #6e6293; |
| 58 | + font-weight: 700; |
| 59 | +
|
| 60 | + em { |
| 61 | + font-size: 100px; |
| 62 | + font-weight: 800; |
| 63 | + font-style: normal; |
| 64 | + color: #240079; |
| 65 | + } |
| 66 | +
|
| 67 | + ${media.tablet} { |
| 68 | + font-size: 70px; |
| 69 | + em { |
| 70 | + font-size: 90px; |
| 71 | + } |
| 72 | + } |
| 73 | +
|
| 74 | + ${media.mobile} { |
| 75 | + font-size: 50px; |
| 76 | + em { |
| 77 | + font-size: 60px; |
| 78 | + } |
| 79 | + } |
| 80 | +`; |
| 81 | + |
| 82 | +const ErrorCommentSofter = styled.span` |
| 83 | + font-size: 50px; |
| 84 | + color: #6e6293; |
| 85 | + font-weight: 400; |
| 86 | +
|
| 87 | + ${media.tablet} { |
| 88 | + font-size: 40px; |
| 89 | + } |
| 90 | +
|
| 91 | + ${media.mobile} { |
| 92 | + font-size: 30px; |
| 93 | + } |
| 94 | +`; |
| 95 | + |
| 96 | +const AirplaneSVG = styled.img` |
| 97 | + width: 250px; |
| 98 | + padding: 30px 0; |
| 99 | +
|
| 100 | + ${media.mobile} { |
| 101 | + width: 200px; |
| 102 | + } |
| 103 | +`; |
| 104 | + |
| 105 | +const HomeButton = styled(PrimaryButton)` |
| 106 | + margin-top: 120px; |
| 107 | + font-weight: 400; |
| 108 | + padding: 14px 90px; |
| 109 | +
|
| 110 | + ${media.tablet} { |
| 111 | + justify-self: anchor-center; |
| 112 | + width: calc(100% - 48px); |
| 113 | + padding: 14px 20px; |
| 114 | + margin: 120px 24px 24px 24px; |
| 115 | + } |
| 116 | +`; |
| 117 | + |
| 118 | +const Error404Page = () => { |
| 119 | + const navigate = useNavigate(); |
| 120 | + |
| 121 | + const handleMainButtonClick = () => { |
| 122 | + navigate("/"); |
| 123 | + }; |
| 124 | + |
| 125 | + useEffect(() => { |
| 126 | + document.title = "404 - Page Not Found"; |
| 127 | + }, []); |
| 128 | + |
| 129 | + return ( |
| 130 | + <TopContainer> |
| 131 | + <ContentsContainer> |
| 132 | + <Contents> |
| 133 | + <AirplaneSVG src={logoImage} /> |
| 134 | + <ErrorNumber>404</ErrorNumber> |
| 135 | + <ErrorComment> |
| 136 | + <em>Oops!</em> Page Not Found... |
| 137 | + </ErrorComment> |
| 138 | + <ErrorCommentSofter> |
| 139 | + Don't worry, let's get you back on track. |
| 140 | + </ErrorCommentSofter> |
| 141 | + <HomeButton |
| 142 | + size={BUTTON_SIZE.large} |
| 143 | + title="메인으로 돌아가기" |
| 144 | + onClick={handleMainButtonClick} |
| 145 | + /> |
| 146 | + </Contents> |
| 147 | + </ContentsContainer> |
| 148 | + </TopContainer> |
| 149 | + ); |
| 150 | +}; |
| 151 | + |
| 152 | +export default Error404Page; |
0 commit comments