Skip to content

Commit b19e288

Browse files
committed
[KB] feat[#267]: 모든 페이지 로딩 중에서 로딩 스피너 적용
1 parent bfad6f5 commit b19e288

File tree

25 files changed

+50
-35
lines changed

25 files changed

+50
-35
lines changed

src/components/Board/Detail/BoardDetail.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { getCommentsCountByCategory } from '~/api/comment.ts';
88
import { Board } from '~/models/Board.ts';
99
import BoardDetailItem from './BoardDetailItem.tsx';
1010
import styles from './BoardDetail.module.css';
11+
import LoadingSpinner from '~/components/Common/LoadingSpinner.tsx';
1112

1213
export default function BoardDetail({ category }: { category: number }) {
1314
const currentUrl = window.location.href;
@@ -70,7 +71,7 @@ export default function BoardDetail({ category }: { category: number }) {
7071
});
7172

7273
if (boardQuery.isFetching || commentCountQuery.isFetching) {
73-
return <div>로딩 중...</div>;
74+
return <LoadingSpinner />;
7475
}
7576

7677
if (boardQuery.isSuccess && commentCountQuery.isSuccess) {

src/components/Board/Edit/BoardEdit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export default function BoardEdit({ category }: BoardEditProps) {
155155

156156
// 로딩 상태 처리
157157
if (boardQuery.isLoading || boardQuery.isLoading) {
158-
return <div>데이터를 불러오는 중입니다...</div>;
158+
return <LoadingSpinner />;
159159
}
160160

161161
if (boardQuery.isError || boardQuery.isError) {

src/components/Board/List/BoardList.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { CATEGORY_STRINGS_EN } from '~/constants/category_strings_en.ts';
66
import BoardItem from '~/components/Board/Item/BoardItem.tsx';
77
import Pagination from '~/components/Pagination/Pagination.tsx';
88
import styles from './BoardList.module.css';
9+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
910

1011
interface BoardListProps {
1112
category: number;
@@ -23,14 +24,11 @@ export default function BoardList({
2324
onPageChange,
2425
}: BoardListProps) {
2526
const renderBoardContent = () => {
27+
if (boardsQuery.isLoading) return <LoadingSpinner />;
28+
2629
if (totalPages === 0)
2730
return <div className={styles.noBoards}>현재 게시물이 없습니다.</div>;
2831

29-
if (boardsQuery.isLoading)
30-
return (
31-
<div className={styles.loading}>데이터를 불러오는 중입니다...</div>
32-
);
33-
3432
if (boardsQuery.isError)
3533
return <div className={styles.error}>에러가 발생했습니다!</div>;
3634

src/components/Book/Detail/BookAdminDetail.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { QUERY_KEY } from '~/api/queryKey.ts';
33
import { Item } from '~/models/Item.ts';
44
import { getItemById } from '~/api/item.ts';
55
import styled from 'styled-components';
6+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
67

78
const Container = styled.div`
89
padding: 10rem;
@@ -29,7 +30,7 @@ function BookAdminDetail() {
2930
let content;
3031

3132
if (itemQuery.isLoading) {
32-
content = <div className="loading">데이터를 불러오는 중입니다...</div>;
33+
content = <LoadingSpinner />;
3334
} else if (itemQuery.isError) {
3435
content = <div className="error">에러가 발생했습니다!</div>;
3536
} else if (itemQuery.isSuccess) {

src/components/Book/Edit/BookAdminEdit.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Item } from '~/models/Item.ts';
66
import { getItemById, updateItem } from '~/api/item.ts';
77
import { onUploadImage } from '~/api/board.ts';
88
import styles from '../../Project/Project.module.css';
9+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
910

1011
function BookAdminEdit() {
1112
const navigate = useNavigate();
@@ -78,7 +79,7 @@ function BookAdminEdit() {
7879
};
7980

8081
if (itemQuery.isLoading) {
81-
content = <div className="loading">데이터를 불러오는 중입니다...</div>;
82+
content = <LoadingSpinner />;
8283
} else if (itemQuery.isError) {
8384
content = <div className="error">에러가 발생했습니다!</div>;
8485
} else if (itemQuery.isSuccess) {

src/components/Book/List/BookAdminList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getItems } from '~/api/item.ts';
66
import { ITEMCATEGORY } from '~/constants/itemCategory.ts';
77
import ItemAdminDelete from '~/components/Book/Delete/BookAdminDelete.tsx';
88
import styled from 'styled-components';
9+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
910

1011
const Container = styled.div`
1112
padding: 10rem;
@@ -61,7 +62,7 @@ function BookAdminList() {
6162
let content;
6263

6364
if (itemQuery.isLoading) {
64-
content = <div>로딩중...</div>;
65+
content = <LoadingSpinner />;
6566
} else if (itemQuery.isError) {
6667
content = <div>에러가 발생했습니다!</div>;
6768
} else if (itemQuery.isSuccess) {

src/components/Book/List/BookList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { QUERY_KEY } from '~/api/queryKey.ts';
44
import { Item } from '~/models/Item.ts';
55
import ItemItem from '~/components/Book/Item/BookItem.tsx';
66
import styles from '~/components/Book/List/BookList.module.css';
7+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
78

89
export default function BookList({ itemCategory }: { itemCategory: number }) {
910
const ItemQuery = useQuery<Item[]>({
@@ -14,7 +15,7 @@ export default function BookList({ itemCategory }: { itemCategory: number }) {
1415
let content;
1516

1617
if (ItemQuery.isLoading) {
17-
content = <div>로딩중...</div>;
18+
content = <LoadingSpinner />;
1819
} else if (ItemQuery.isError) {
1920
content = <div className="error">에러가 발생했습니다!</div>;
2021
} else if (ItemQuery.isSuccess) {

src/components/Comment/List/CommetList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Comment } from '~/models/Comment.ts';
33
import { QUERY_KEY } from '~/api/queryKey.ts';
44
import { getCommentsByBoardId } from '~/api/comment.ts';
55
import CommentItem from '~/components/Comment/Item/CommentItem.tsx';
6+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
67

78
export default function CommentList({ id }: { id: number }) {
89
const commentsQuery = useQuery<Comment[]>({
@@ -13,7 +14,7 @@ export default function CommentList({ id }: { id: number }) {
1314
let content;
1415

1516
if (commentsQuery.isLoading) {
16-
content = <div className="loading">데이터를 불러오는 중입니다...</div>;
17+
content = <LoadingSpinner />;
1718
} else if (commentsQuery.isError) {
1819
content = <div className="error">에러가 발생했습니다!</div>;
1920
} else if (commentsQuery.isSuccess) {

src/components/Havruta/Havruta/Edit/HavrutaEdit.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getHavrutaById, updateHavruta } from '~/api/havruta/havruta';
55
import { Havruta } from '~/models/Havruta';
66
import styled from 'styled-components';
77
import { QUERY_KEY } from '~/api/queryKey';
8+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
89

910
const Container = styled.div`
1011
padding: 10rem;
@@ -62,7 +63,7 @@ function HavrutaEdit() {
6263
};
6364

6465
if (havrutaQuery.isLoading) {
65-
content = <div>데이터를 불러오는 중입니다...</div>;
66+
content = <LoadingSpinner />;
6667
} else if (havrutaQuery.isError) {
6768
content = <div>에러가 발생했습니다!!</div>;
6869
} else if (havrutaQuery.isSuccess) {

src/components/Havruta/Havruta/List/HavrutaList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Havruta } from '~/models/Havruta';
55
import { getAllHavrutas } from '~/api/havruta/havruta';
66
import HavrutaDelete from '~/components/Havruta/Havruta/Delete/HavrutaDelete';
77
import styled from 'styled-components';
8+
import LoadingSpinner from '~/components/Common/LoadingSpinner';
89

910
const Container = styled.div``;
1011

@@ -59,7 +60,7 @@ function HavrutaList() {
5960
let content;
6061

6162
if (havrutaQuery.isLoading) {
62-
content = <div>로딩중...</div>;
63+
content = <LoadingSpinner />;
6364
} else if (havrutaQuery.isError) {
6465
content = <div>에러가 발생했습니다!</div>;
6566
} else if (havrutaQuery.isSuccess) {

0 commit comments

Comments
 (0)