Skip to content

Commit

Permalink
feat : 404 에러 페이지 개발 (#271)
Browse files Browse the repository at this point in the history
* fix : 모달 닫힘 버튼 수정

* feat : 에러 페이지 설정

* style : 공유 컴포넌트 반응형

* env : 의존성 설치

* style : 차트 반응형

* style : 로그인 반응형

* style : 마이 페이지 반응형

* env : 배포 환경에서 콘솔 제거
  • Loading branch information
HelloWook authored Nov 7, 2024
1 parent e4c003e commit 36cdcd7
Show file tree
Hide file tree
Showing 26 changed files with 298 additions and 89 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"axios-mock-adapter": "^2.1.0",
"date-fns": "^4.1.0",
"favicons": "^7.2.0",
"framer-motion": "^11.11.11",
"husky": "^9.1.6",
"init": "^0.1.2",
"jest": "^29.7.0",
Expand All @@ -16,6 +17,7 @@
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-intersection-observer": "^9.13.1",
"react-responsive": "^10.0.0",
"react-router-dom": "^6.27.0",
"react-spinners": "^0.14.1",
"recharts": "^2.13.0",
Expand Down
8 changes: 6 additions & 2 deletions src/app/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,14 @@ const router = createBrowserRouter([
{
path: '/account',
element: (
<ProtectedRoute>
<PublicRoute>
<AccountPage />
</ProtectedRoute>
</PublicRoute>
)
},
{
path: '*',
element: <AccountPage />
}
]
}
Expand Down
19 changes: 13 additions & 6 deletions src/entities/chart/ui/Chart.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import React from 'react';
import {
DailyConditionType,
WeeklyConditionSummaryType
} from '@/shared/model/conditionTypes';

import {
LineChart,
Expand All @@ -13,8 +9,13 @@ import {
Tooltip,
ResponsiveContainer
} from 'recharts';
import isDailyEmotion from '../lib/isDailyEmotion';
import { ScaleLoader } from 'react-spinners';
import {
DailyConditionType,
WeeklyConditionSummaryType
} from '@/shared/model/conditionTypes';
import isDailyEmotion from '../lib/isDailyEmotion';
import { useMediaQuery } from 'react-responsive';

const emotions = ['매우 나쁨', '나쁨', '보통', '좋음', '매우 좋음'];

Expand All @@ -24,6 +25,8 @@ interface ChartProps {
}

const Chart = ({ data, isLoading }: ChartProps) => {
const isMobile = useMediaQuery({ maxWidth: 640 }); // 화면 너비가 600px 이하인 경우

return isLoading ? (
<div
style={{
Expand All @@ -36,7 +39,7 @@ const Chart = ({ data, isLoading }: ChartProps) => {
<ScaleLoader color="#DBDBDB" />
</div>
) : (
<ResponsiveContainer width="100%" height={400}>
<ResponsiveContainer width="100%" height={isMobile ? 300 : 400}>
<LineChart
data={data}
margin={{ top: 20, right: 10, left: 10, bottom: 20 }}
Expand All @@ -50,6 +53,7 @@ const Chart = ({ data, isLoading }: ChartProps) => {
dy={10}
height={50}
axisLine={false}
tick={{ fontSize: isMobile ? 10 : 12 }}
/>
<YAxis
type="category"
Expand All @@ -59,6 +63,7 @@ const Chart = ({ data, isLoading }: ChartProps) => {
domain={emotions}
ticks={emotions}
allowDuplicatedCategory={false}
tick={{ fontSize: isMobile ? 10 : 12 }}
/>
<Line
type="monotone"
Expand All @@ -76,6 +81,7 @@ const Chart = ({ data, isLoading }: ChartProps) => {
dy={10}
height={50}
axisLine={false}
tick={{ fontSize: isMobile ? 10 : 12 }}
/>
<YAxis
type="category"
Expand All @@ -85,6 +91,7 @@ const Chart = ({ data, isLoading }: ChartProps) => {
domain={emotions}
ticks={emotions}
allowDuplicatedCategory={false}
tick={{ fontSize: isMobile ? 10 : 12 }}
/>
<Line
type="monotone"
Expand Down
27 changes: 27 additions & 0 deletions src/entities/dataSldier/DateSlider.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ export const MonthWeekSelectorWrapper = styled.div`
align-items: center;
justify-content: center;
font-size: 20px;
@media (max-width: 768px) {
font-size: 16px;
}
@media (max-width: 480px) {
font-size: 12px;
}
`;

export const ArrowButton = styled.button`
Expand All @@ -17,13 +23,34 @@ export const ArrowButton = styled.button`
&:focus {
outline: none;
}
@media (max-width: 768px) {
font-size: 16px;
}
@media (max-width: 480px) {
font-size: 12px;
}
`;

export const Display = styled.span`
margin: 0 140px;
font-size: 20px;
@media (max-width: 768px) {
font-size: 16px;
margin: 0 100px;
}
@media (max-width: 480px) {
font-size: 12px;
margin: 0 60px;
}
`;

export const SliderInfoContainer = styled.div`
margin-bottom: 100px;
@media (max-width: 768px) {
margin-bottom: 60px;
}
@media (max-width: 480px) {
margin-bottom: 20px;
}
`;
25 changes: 24 additions & 1 deletion src/features/chart/ui/EmotionChart.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@ export const ChartInfoStyled = styled.h4`
margin-top: 12px;
font-size: 20px;
color: #a4a4a4;
@media (max-width: 768px) {
font-size: 16px;
}
@media (max-width: 480px) {
font-size: 12px;
}
`;

export const ButtonContainer = styled.div<SkeletonProps>`
display: flex;
gap: 10px;
margin-top: 10px;
margin-bottom: 20px;
justify-content: flex-end;
width: 100%;
@media (max-width: 760px) {
margin-top: 5px;
margin-bottom: 10px;
}
`;

export const ChartButtonStlyed = styled.button`
Expand All @@ -25,6 +36,11 @@ export const ChartButtonStlyed = styled.button`
cursor: pointer;
background-color: rgba(0, 0, 0, 0.04);
}
@media (max-width: 768px) {
padding: 5px 5px;
font-size: 10px;
}
`;

export const ChartWrapper = styled.div<SkeletonProps>`
Expand All @@ -34,11 +50,18 @@ export const ChartWrapper = styled.div<SkeletonProps>`
width: 100%;
box-shadow: 0px 4px 20px 0px rgba(200, 200, 200, 0.3);
padding: 50px 90px 90px 90px;
@media (max-width: 760px) {
padding: 30px 40px 50px 40px;
}
`;

export const EmotionChartStlyed = styled.div`
max-width: 960px;
margin: auto;
padding-top: 150px;
min-height: 940px;
height: 940px;
@media (max-width: 760px) {
width: 90%;
height: 700px;
}
`;
17 changes: 17 additions & 0 deletions src/pages/ErrorPage/ui/ErrorPage.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Meta, StoryObj } from '@storybook/react';

import ErrorPage from './ErrorPage';

const meta: Meta<typeof ErrorPage> = {
component: ErrorPage,
title: 'ErrorPage',
tags: ['autodocs'],
argTypes: {},
};
export default meta;

type Story = StoryObj<typeof ErrorPage>;

export const Default: Story = {
args: {},
};
41 changes: 41 additions & 0 deletions src/pages/ErrorPage/ui/ErrorPage.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import styled from 'styled-components';

export const ErrorPageStyled = styled.div`
max-width: 960px;
width: 90%;
margin: auto;
display: flex;
flex-direction: column;
@media (max-width: 768px) {
max-width: 100%;
padding: 0 20px;
}
`;

export const ErrorImage = styled.img`
object-fit: cover;
margin: auto;
width: 100%;
@media (max-width: 768px) {
width: 80%;
}
`;

export const ErrorTilte = styled.h2`
text-align: center;
font-size: 50px;
a {
text-decoration: none;
color: black;
}
@media (max-width: 768px) {
font-size: 36px;
}
@media (max-width: 480px) {
font-size: 28px;
}
`;
20 changes: 20 additions & 0 deletions src/pages/ErrorPage/ui/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import cat from '@/shared/assets/cuteCat.gif';
import { ErrorPageStyled, ErrorTilte, ErrorImage } from './ErrorPage.styled';
import Margin from '@/shared/ui/Margin/Margin';
import Title from '@/shared/ui/Title/Title';
import { Link } from 'react-router-dom';

const ErrorPage = () => {
return (
<ErrorPageStyled>
<Margin top={160} />
<ErrorImage src={`${cat}`} alt="logo" />
<ErrorTilte>
<Link to="/">404 Error Please Click Here </Link>
</ErrorTilte>
</ErrorPageStyled>
);
};

export default ErrorPage;
6 changes: 5 additions & 1 deletion src/pages/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import Login from '@/widgets/Login/Login';
import React from 'react';

const LoginPage = () => {
return <Login />;
return (
<div>
<Login />
</div>
);
};

export default LoginPage;
Binary file added src/shared/assets/cuteCat.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/shared/ui/Button/Button.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ export const StyledButton = styled.button.withConfig({
return props.hasBorder ? '#FFF4F1' : '#E13600'; // hasBorder에 따른 배경색
}};
}
@media (max-width: 760px) {
width: 100%;
}
`;
6 changes: 6 additions & 0 deletions src/shared/ui/Info/Info.styeld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ export const InfoStyled = styled.h4<SkeletonProps>`
margin-top: 12px;
font-size: 20px;
color: #a4a4a4;
@media (max-width: 768px) {
font-size: 16px;
}
@media (max-width: 480px) {
font-size: 12px;
}
`;
2 changes: 1 addition & 1 deletion src/shared/ui/InputForm/InputForm.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const InputContainer = styled.div<{
}>`
display: flex;
flex-direction: column;
width: ${(props) => props.width};
max-width: ${(props) => props.width};
font-family: 'Pretendard', sans-serif;
`;

Expand Down
Loading

0 comments on commit 36cdcd7

Please sign in to comment.