Skip to content

Commit 9543b86

Browse files
committed
fix: loading
1 parent ce71f52 commit 9543b86

File tree

5 files changed

+62
-60
lines changed

5 files changed

+62
-60
lines changed

src/components/HomeSwiper.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ const HomeSwiper = () => {
3030
})();
3131
}, []);
3232

33+
if (isLoading) return <LoadingSpinner />;
34+
3335
return (
3436
<>
35-
{isLoading && <LoadingSpinner />}
3637
<Swiper
3738
css={css`
3839
margin-top: 30px;

src/components/MyWritingSwiper.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ const MyWritingSwiper = () => {
3030
})();
3131
}, []);
3232

33+
if (isLoading) return <LoadingSpinner />;
34+
3335
return (
3436
<>
35-
{isLoading && <LoadingSpinner />}
3637
<Swiper
3738
css={css`
3839
margin-top: 30px;

src/components/OthersDayBook.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ const OthersWriting = () => {
3636
getData(id);
3737
}, [id]);
3838

39+
if (isLoading) return <LoadingSpinner />;
40+
3941
return (
4042
<>
41-
{isLoading && <LoadingSpinner />}
4243
<Header>
4344
<Header.Button variety="back" />
4445
다른 사람 일지

src/components/SwiperFooter.tsx

+26-28
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
1-
import styled from '@emotion/styled';
2-
import SwipePrevButton from './SwipePrevButton';
3-
import SwipeNextButton from './SwipeNextButton';
4-
import CardIndicator, { CardIndicatorProps } from './CardIndicator';
5-
import { FC } from 'react';
1+
import styled from "@emotion/styled";
2+
import SwipePrevButton from "./SwipePrevButton";
3+
import SwipeNextButton from "./SwipeNextButton";
4+
import CardIndicator, { CardIndicatorProps } from "./CardIndicator";
5+
import { FC } from "react";
66

7-
interface SwiperFooterProps extends CardIndicatorProps { }
7+
interface SwiperFooterProps extends CardIndicatorProps {}
88

99
const SwiperFooter: FC<SwiperFooterProps> = ({ maxIndex, currentIndex }) => {
10-
11-
return (
12-
<Wrapper>
13-
<div>
14-
<SwipePrevButton />
15-
<CardIndicator maxIndex={maxIndex} currentIndex={currentIndex} />
16-
<SwipeNextButton />
17-
</div>
18-
</Wrapper>
19-
);
10+
return (
11+
<Wrapper>
12+
<div>
13+
<SwipePrevButton />
14+
<CardIndicator maxIndex={maxIndex} currentIndex={currentIndex} />
15+
<SwipeNextButton />
16+
</div>
17+
</Wrapper>
18+
);
2019
};
2120

2221
export default SwiperFooter;
2322

2423
const Wrapper = styled.article`
25-
width: 100%;
26-
height: 56px;
24+
width: 100%;
25+
height: 56px;
26+
27+
display: flex;
28+
justify-content: center;
29+
align-items: center;
2730
31+
& > div {
32+
width: 336px;
2833
display: flex;
29-
justify-content: center;
34+
justify-content: space-between;
3035
align-items: center;
31-
32-
& > div {
33-
width: 336px;
34-
display: flex;
35-
justify-content: space-between;
36-
align-items: center;
37-
}
38-
39-
`
36+
}
37+
`;

src/pages/write/index.tsx

+30-29
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import Header from '@components/Header';
2-
import Button from '@components/Button';
3-
import { css } from '@emotion/react';
4-
import styled from '@emotion/styled';
5-
import useStep, { STEP, StepContent, StepContentMap } from '@hooks/useStep';
6-
import getFontStyle from '@theme/font/getFontSize';
7-
import 쓰기 from '@pages/write/쓰기';
8-
import 완료 from '@pages/write/완료';
9-
import 탄생 from '@pages/write/탄생';
10-
import 형태 from '@pages/write/형태';
11-
import 선택 from '@pages/write/선택';
12-
import { useAtom, useAtomValue } from 'jotai';
13-
import { daybookAtom, tagInputAtom } from '@state/daybook';
14-
import { useEffect } from 'react';
15-
import { RESET } from 'jotai/utils';
16-
import { fadeLeftAnimation } from '@theme/animation';
17-
import { useSearchParams } from 'react-router-dom';
18-
import { paperTypeState } from '@state/paperType';
19-
import LoadingSpinner from '@components/LoadingSpinner';
1+
import Header from "@components/Header";
2+
import Button from "@components/Button";
3+
import { css } from "@emotion/react";
4+
import styled from "@emotion/styled";
5+
import useStep, { STEP, StepContent, StepContentMap } from "@hooks/useStep";
6+
import getFontStyle from "@theme/font/getFontSize";
7+
import 쓰기 from "@pages/write/쓰기";
8+
import 완료 from "@pages/write/완료";
9+
import 탄생 from "@pages/write/탄생";
10+
import 형태 from "@pages/write/형태";
11+
import 선택 from "@pages/write/선택";
12+
import { useAtom, useAtomValue } from "jotai";
13+
import { daybookAtom, tagInputAtom } from "@state/daybook";
14+
import { useEffect } from "react";
15+
import { RESET } from "jotai/utils";
16+
import { fadeLeftAnimation } from "@theme/animation";
17+
import { useSearchParams } from "react-router-dom";
18+
import { paperTypeState } from "@state/paperType";
19+
import LoadingSpinner from "@components/LoadingSpinner";
2020

2121
const STEP_COMPONENTS = {
2222
[STEP.선택]: 선택,
@@ -29,7 +29,7 @@ const STEP_COMPONENTS = {
2929
function Write() {
3030
const { isLoading, step, nextStep, previousStep } = useStep();
3131
const [searchParams] = useSearchParams();
32-
const query = searchParams.get('from');
32+
const query = searchParams.get("from");
3333

3434
const StepComponent = STEP_COMPONENTS[step];
3535
const { title, description, buttonText } = StepContentMap.get(
@@ -42,41 +42,42 @@ function Write() {
4242

4343
const buttonDisableHandler = () => {
4444
if (!paperTypeAtom) return true;
45-
if (step === '쓰기' && daybook.content.trim().length === 0) return true;
46-
if (step === '탄생' && daybook.category.length === 0) return true;
47-
if (step === '형태' && daybook.hashtags.length === 0) return true;
45+
if (step === "쓰기" && daybook.content.trim().length === 0) return true;
46+
if (step === "탄생" && daybook.category.length === 0) return true;
47+
if (step === "형태" && daybook.hashtags.length === 0) return true;
4848
return false;
4949
};
5050

5151
useEffect(() => {
5252
setDaybook(RESET);
5353
}, [setDaybook]);
5454

55+
if (isLoading) return <LoadingSpinner />;
56+
5557
return (
5658
<>
57-
{isLoading && <LoadingSpinner />}
5859
<Header title="일지 작성하기">
59-
{step !== '완료' && (
60+
{step !== "완료" && (
6061
<Header.Button variety="back" onClick={previousStep} />
6162
)}
6263
</Header>
6364
<Wrapper>
6465
<p
6566
css={css`
6667
white-space: pre-wrap;
67-
${getFontStyle('header1')}
68+
${getFontStyle("header1")}
6869
${fadeLeftAnimation}
6970
`}
7071
>
71-
{step === '완료' && query === 'new'
72-
? '축하합니다!\n첫 일지 기록을 완료하였습니다'
72+
{step === "완료" && query === "new"
73+
? "축하합니다!\n첫 일지 기록을 완료하였습니다"
7374
: title}
7475
</p>
7576
<p
7677
css={css`
7778
white-space: pre-wrap;
7879
margin-top: 9px;
79-
${getFontStyle('title4')}
80+
${getFontStyle("title4")}
8081
${fadeLeftAnimation}
8182
`}
8283
>

0 commit comments

Comments
 (0)