From 2d90b3407f90e6200369324cedc416029b7776a8 Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Fri, 3 May 2024 17:59:13 +0900 Subject: [PATCH 01/10] =?UTF-8?q?chore:=20=EC=96=B4=EC=85=8B=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icon/ic_zigzag_star_off.svg | 3 +++ src/assets/icon/ic_zigzag_star_on.svg | 3 +++ src/assets/index.ts | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 src/assets/icon/ic_zigzag_star_off.svg create mode 100644 src/assets/icon/ic_zigzag_star_on.svg diff --git a/src/assets/icon/ic_zigzag_star_off.svg b/src/assets/icon/ic_zigzag_star_off.svg new file mode 100644 index 00000000..c40abdb5 --- /dev/null +++ b/src/assets/icon/ic_zigzag_star_off.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/ic_zigzag_star_on.svg b/src/assets/icon/ic_zigzag_star_on.svg new file mode 100644 index 00000000..3ee4eb00 --- /dev/null +++ b/src/assets/icon/ic_zigzag_star_on.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/index.ts b/src/assets/index.ts index ed6b3d97..a8bab1aa 100644 --- a/src/assets/index.ts +++ b/src/assets/index.ts @@ -30,6 +30,8 @@ import IcStar from './icon/ic_star.svg?react'; import IcStarDefault from './icon/ic_star_default.svg?react'; import IcWaste from './icon/ic_waste.svg?react'; import IcX from './icon/ic_x.svg?react'; +import IcZigzagStarOff from './icon/ic_zigzag_star_off.svg?react'; +import IcZigzagStarOn from './icon/ic_zigzag_star_on.svg?react'; import ImgBook from './img/img_book.svg?react'; import ImgBookBackgray from './img/img_book_backgray.svg?react'; import ImgBookOrange from './img/img_book_orange.svg?react'; @@ -98,6 +100,8 @@ export { IcStarDefault, IcWaste, IcX, + IcZigzagStarOff, + IcZigzagStarOn, ImgBook, ImgBookBackgray, ImgBookOrange, From ccc1079bed4cf5b6d3b96d60e18f28b3cbfc38ae Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Sat, 4 May 2024 13:56:59 +0900 Subject: [PATCH 02/10] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookInfoBox/BookInfoBox.style.ts | 9 +++++++++ src/Detail/components/BookInfoBox/index.tsx | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Detail/components/BookInfoBox/BookInfoBox.style.ts b/src/Detail/components/BookInfoBox/BookInfoBox.style.ts index 2312e313..dfc2d363 100644 --- a/src/Detail/components/BookInfoBox/BookInfoBox.style.ts +++ b/src/Detail/components/BookInfoBox/BookInfoBox.style.ts @@ -67,6 +67,10 @@ export const BookInfoHeaderItem = styled.p<{ backgroundColor: string }>` `; export const BookInfoTitle = styled.p<{ backgroundColor: string }>` + display: flex; + gap: 0.5rem; + align-items: center; + margin-top: 0.7rem; color: ${({ theme, backgroundColor }) => { @@ -96,3 +100,8 @@ export const BookInfoContent = styled.p<{ backgroundColor: string }>` }}; ${({ theme }) => theme.fonts.Body3_R_14}; `; + +export const FavoriteBtn = styled.button` + width: 2.2rem; + height: 2.2rem; +`; diff --git a/src/Detail/components/BookInfoBox/index.tsx b/src/Detail/components/BookInfoBox/index.tsx index 2ce5db11..ea36cd7e 100644 --- a/src/Detail/components/BookInfoBox/index.tsx +++ b/src/Detail/components/BookInfoBox/index.tsx @@ -1,4 +1,9 @@ -import { IcCrown, IcDate } from '../../../assets'; +import { + IcCrown, + IcDate, + IcZigzagStarOff, + IcZigzagStarOn, +} from '../../../assets'; import * as S from './BookInfoBox.style'; interface BookInfoBoxProps { @@ -8,6 +13,7 @@ interface BookInfoBoxProps { title: string; description: string; bookBackgroundColor: string; + isFavorite?: boolean; } function BookInfoBox({ @@ -17,6 +23,7 @@ function BookInfoBox({ title, description, bookBackgroundColor, + isFavorite, }: BookInfoBoxProps) { return ( @@ -40,6 +47,16 @@ function BookInfoBox({ {title} + {isFavorite && + (isFavorite ? ( + + + + ) : ( + + + + ))} {description} From c0689e6a8666ab696487839e3df56a009892ba62 Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Sat, 4 May 2024 14:24:52 +0900 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=EC=9D=BC=20=EB=95=8C=20bookDetail=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Detail/api/getBookDetailLogin.ts | 13 +++++++++++++ src/Detail/hooks/useGetBookDetailLogin.ts | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/Detail/api/getBookDetailLogin.ts create mode 100644 src/Detail/hooks/useGetBookDetailLogin.ts diff --git a/src/Detail/api/getBookDetailLogin.ts b/src/Detail/api/getBookDetailLogin.ts new file mode 100644 index 00000000..6606dec8 --- /dev/null +++ b/src/Detail/api/getBookDetailLogin.ts @@ -0,0 +1,13 @@ +import { api } from '../../libs/api'; + +export async function getBookDetailLogin(bookUuid: string) { + const token = window.localStorage.getItem('token'); + const data = await api.get(`/api/books/favorite/${bookUuid}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }); + + return data.data.data; +} diff --git a/src/Detail/hooks/useGetBookDetailLogin.ts b/src/Detail/hooks/useGetBookDetailLogin.ts new file mode 100644 index 00000000..5be17f50 --- /dev/null +++ b/src/Detail/hooks/useGetBookDetailLogin.ts @@ -0,0 +1,22 @@ +import { useQuery } from 'react-query'; +import { useNavigate } from 'react-router-dom'; + +import { getBookDetailLogin } from '../api/getBookDetailLogin'; + +export default function useGetBookDetailLogin(bookUuid: string) { + const navigate = useNavigate(); + + const { data: bookDetail, isLoading } = useQuery( + ['useGetBookDetailLogin', bookUuid], + () => getBookDetailLogin(bookUuid), + { + onError: () => { + navigate('/error'); + }, + refetchOnMount: 'always', + refetchOnWindowFocus: false, + }, + ); + + return { bookDetail, isLoading }; +} From 4824851207c12a4d27c917c7d3328ea7a0d72f64 Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Sat, 4 May 2024 14:28:32 +0900 Subject: [PATCH 04/10] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=20=EB=B3=84=20hook=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Detail/page/DetailPage/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Detail/page/DetailPage/index.tsx b/src/Detail/page/DetailPage/index.tsx index 0a95f266..d66c5762 100644 --- a/src/Detail/page/DetailPage/index.tsx +++ b/src/Detail/page/DetailPage/index.tsx @@ -8,13 +8,18 @@ import BookInfoBox from '../../components/BookInfoBox'; import LecueNoteListContainer from '../../components/LecueNoteListContainer'; import SlideBanner from '../../components/SlideBanner'; import useGetBookDetail from '../../hooks/useGetBookDetail'; +import useGetBookDetailLogin from '../../hooks/useGetBookDetailLogin'; import * as S from './DetailPage.style'; function DetailPage() { const [isEditable, setIsEditable] = useState(true); + const token = window.localStorage.getItem('token'); + const { bookUuid } = useParams() as { bookUuid: string }; - const { bookDetail, isLoading } = useGetBookDetail(bookUuid); + const { bookDetail, isLoading } = token + ? useGetBookDetailLogin(bookUuid) + : useGetBookDetail(bookUuid); const postMutation = usePostStickerState(bookUuid); const setEditableStateFalse = () => { From ec4c6103de4a562f09494f6679ef816a2b72ca71 Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Sun, 5 May 2024 23:44:15 +0900 Subject: [PATCH 05/10] =?UTF-8?q?chore:=20=EB=A0=88=ED=81=90=EB=B6=81=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=EA=B8=80=EC=9E=90=EC=88=98=20limit=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CreateBook/components/BookInput/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CreateBook/components/BookInput/index.tsx b/src/CreateBook/components/BookInput/index.tsx index 90f36667..e85fd361 100644 --- a/src/CreateBook/components/BookInput/index.tsx +++ b/src/CreateBook/components/BookInput/index.tsx @@ -7,7 +7,7 @@ interface BookInputProps { function BookInput({ title, changeTitle }: BookInputProps) { const handleChangeInput = (e: React.ChangeEvent) => { - if (e.target.value.length <= 15) { + if (e.target.value.length <= 10) { changeTitle(e.target.value); } }; @@ -20,7 +20,7 @@ function BookInput({ title, changeTitle }: BookInputProps) { value={title} onChange={handleChangeInput} /> - ({title.length}/15) + ({title.length}/10) ); From 1c642452cc26b240898b2d79d4f045f0b252ffba Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Mon, 6 May 2024 23:39:49 +0900 Subject: [PATCH 06/10] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20post=20/=20delete=20api=20=EB=B6=99=EC=9D=B4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Detail/components/BookInfoBox/index.tsx | 26 +++++++++++++++++--- src/Detail/hooks/useGetBookDetailLogin.ts | 2 +- src/History/components/MyLecueBook/index.tsx | 2 +- src/libs/hooks/useDeleteFavorite.ts | 6 +++++ src/libs/hooks/usePostFavorite.ts | 23 ++++++++++++++--- 5 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/Detail/components/BookInfoBox/index.tsx b/src/Detail/components/BookInfoBox/index.tsx index ea36cd7e..01e48493 100644 --- a/src/Detail/components/BookInfoBox/index.tsx +++ b/src/Detail/components/BookInfoBox/index.tsx @@ -1,9 +1,13 @@ +import { useEffect, useState } from 'react'; + import { IcCrown, IcDate, IcZigzagStarOff, IcZigzagStarOn, } from '../../../assets'; +import useDeleteFavorite from '../../../libs/hooks/useDeleteFavorite'; +import usePostFavorite from '../../../libs/hooks/usePostFavorite'; import * as S from './BookInfoBox.style'; interface BookInfoBoxProps { @@ -13,6 +17,7 @@ interface BookInfoBoxProps { title: string; description: string; bookBackgroundColor: string; + bookId: number; isFavorite?: boolean; } @@ -24,7 +29,22 @@ function BookInfoBox({ description, bookBackgroundColor, isFavorite, + bookId, }: BookInfoBoxProps) { + const token = window.localStorage.getItem('token'); + const [isLogin, setIsLogin] = useState(false); + + const postFavoriteMutation = usePostFavorite('lecueBookDetail'); + const deleteFavoriteMutation = useDeleteFavorite('lecueBookDetail'); + + const handleFavoriteBtn = () => { + isFavorite ? deleteFavoriteMutation(bookId) : postFavoriteMutation(bookId); + }; + + useEffect(() => { + token ? setIsLogin(true) : setIsLogin(false); + }, []); + return ( @@ -47,13 +67,13 @@ function BookInfoBox({ {title} - {isFavorite && + {isLogin && (isFavorite ? ( - + ) : ( - + ))} diff --git a/src/Detail/hooks/useGetBookDetailLogin.ts b/src/Detail/hooks/useGetBookDetailLogin.ts index 5be17f50..392f693e 100644 --- a/src/Detail/hooks/useGetBookDetailLogin.ts +++ b/src/Detail/hooks/useGetBookDetailLogin.ts @@ -7,7 +7,7 @@ export default function useGetBookDetailLogin(bookUuid: string) { const navigate = useNavigate(); const { data: bookDetail, isLoading } = useQuery( - ['useGetBookDetailLogin', bookUuid], + ['get-bookDetail-login'], () => getBookDetailLogin(bookUuid), { onError: () => { diff --git a/src/History/components/MyLecueBook/index.tsx b/src/History/components/MyLecueBook/index.tsx index 116a45fc..46e2ef0d 100644 --- a/src/History/components/MyLecueBook/index.tsx +++ b/src/History/components/MyLecueBook/index.tsx @@ -25,7 +25,7 @@ function MyLecueBook(props: LecueBookProps) { const navigate = useNavigate(); const deleteBookMutation = useDeleteMyBook(); - const postFavoriteMutation = usePostFavorite(); + const postFavoriteMutation = usePostFavorite('mypage'); const deleteFavoriteMutation = useDeleteFavorite('myLecueBook'); const convertNoteCount = (noteNum: number) => { diff --git a/src/libs/hooks/useDeleteFavorite.ts b/src/libs/hooks/useDeleteFavorite.ts index dc200741..06a8e06b 100644 --- a/src/libs/hooks/useDeleteFavorite.ts +++ b/src/libs/hooks/useDeleteFavorite.ts @@ -26,6 +26,12 @@ const useDeleteFavorite = (state: string) => { exact: true, }); break; + + case 'lecueBookDetail': + queryClient.refetchQueries(['get-bookDetail-login'], { + exact: true, + }); + break; } }; diff --git a/src/libs/hooks/usePostFavorite.ts b/src/libs/hooks/usePostFavorite.ts index 935869fa..6391193a 100644 --- a/src/libs/hooks/usePostFavorite.ts +++ b/src/libs/hooks/usePostFavorite.ts @@ -3,18 +3,33 @@ import { useNavigate } from 'react-router-dom'; import postFavorite from '../api/postFavorite'; -const usePostFavorite = () => { +const usePostFavorite = (state: string) => { const navigate = useNavigate(); const queryClient = useQueryClient(); + + const handleRefetchQueries = (state: string) => { + switch (state) { + case 'mypage': + queryClient.refetchQueries(['get-my-lecueBook'], { + exact: true, + }); + break; + + case 'lecueBookDetail': + queryClient.refetchQueries(['get-bookDetail-login'], { + exact: true, + }); + break; + } + }; + const mutation = useMutation({ mutationFn: (bookId: number) => { return postFavorite(bookId); }, onError: () => navigate('/error'), onSuccess: () => { - queryClient.refetchQueries(['get-my-lecueBook'], { - exact: true, - }); + handleRefetchQueries(state); }, }); return mutation.mutate; From 126b201f907fb48c98dac5a7b258e5dad627a4f5 Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Tue, 7 May 2024 18:13:04 +0900 Subject: [PATCH 07/10] =?UTF-8?q?fix:=20=EB=B7=B0=20=EC=A7=84=EC=9E=85?= =?UTF-8?q?=EC=8B=9C=20=EC=9D=B4=EC=A0=84=20=EB=A0=88=ED=81=90=EB=B6=81=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20=EB=B3=B4=EC=9D=B4=EB=8A=94=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Detail/components/BookInfoBox/index.tsx | 6 ++++-- src/Detail/hooks/useGetBookDetailLogin.ts | 2 +- src/Detail/page/DetailPage/index.tsx | 2 +- src/libs/hooks/useDeleteFavorite.ts | 8 ++++---- src/libs/hooks/usePostFavorite.ts | 8 ++++---- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Detail/components/BookInfoBox/index.tsx b/src/Detail/components/BookInfoBox/index.tsx index 01e48493..3a597a81 100644 --- a/src/Detail/components/BookInfoBox/index.tsx +++ b/src/Detail/components/BookInfoBox/index.tsx @@ -19,6 +19,7 @@ interface BookInfoBoxProps { bookBackgroundColor: string; bookId: number; isFavorite?: boolean; + bookUuid: string; } function BookInfoBox({ @@ -30,12 +31,13 @@ function BookInfoBox({ bookBackgroundColor, isFavorite, bookId, + bookUuid, }: BookInfoBoxProps) { const token = window.localStorage.getItem('token'); const [isLogin, setIsLogin] = useState(false); - const postFavoriteMutation = usePostFavorite('lecueBookDetail'); - const deleteFavoriteMutation = useDeleteFavorite('lecueBookDetail'); + const postFavoriteMutation = usePostFavorite('lecueBookDetail', bookUuid); + const deleteFavoriteMutation = useDeleteFavorite('lecueBookDetail', bookUuid); const handleFavoriteBtn = () => { isFavorite ? deleteFavoriteMutation(bookId) : postFavoriteMutation(bookId); diff --git a/src/Detail/hooks/useGetBookDetailLogin.ts b/src/Detail/hooks/useGetBookDetailLogin.ts index 392f693e..3dab977f 100644 --- a/src/Detail/hooks/useGetBookDetailLogin.ts +++ b/src/Detail/hooks/useGetBookDetailLogin.ts @@ -7,7 +7,7 @@ export default function useGetBookDetailLogin(bookUuid: string) { const navigate = useNavigate(); const { data: bookDetail, isLoading } = useQuery( - ['get-bookDetail-login'], + ['get-bookDetail-login', bookUuid], () => getBookDetailLogin(bookUuid), { onError: () => { diff --git a/src/Detail/page/DetailPage/index.tsx b/src/Detail/page/DetailPage/index.tsx index d66c5762..596bfd2d 100644 --- a/src/Detail/page/DetailPage/index.tsx +++ b/src/Detail/page/DetailPage/index.tsx @@ -34,7 +34,7 @@ function DetailPage() { - + { +const useDeleteFavorite = (state: string, bookUuid?: string) => { const navigate = useNavigate(); const queryClient = useQueryClient(); - const handleRefetchQueries = (state: string) => { + const handleRefetchQueries = (state: string, bookUuid?: string) => { switch (state) { case 'home': queryClient.refetchQueries(['get-favorite'], { @@ -28,7 +28,7 @@ const useDeleteFavorite = (state: string) => { break; case 'lecueBookDetail': - queryClient.refetchQueries(['get-bookDetail-login'], { + queryClient.refetchQueries(['get-bookDetail-login', bookUuid], { exact: true, }); break; @@ -41,7 +41,7 @@ const useDeleteFavorite = (state: string) => { }, onError: () => navigate('/error'), onSuccess: () => { - handleRefetchQueries(state); + handleRefetchQueries(state, bookUuid); }, }); return mutation.mutate; diff --git a/src/libs/hooks/usePostFavorite.ts b/src/libs/hooks/usePostFavorite.ts index 6391193a..4b5c39d9 100644 --- a/src/libs/hooks/usePostFavorite.ts +++ b/src/libs/hooks/usePostFavorite.ts @@ -3,11 +3,11 @@ import { useNavigate } from 'react-router-dom'; import postFavorite from '../api/postFavorite'; -const usePostFavorite = (state: string) => { +const usePostFavorite = (state: string, bookUuid?: string) => { const navigate = useNavigate(); const queryClient = useQueryClient(); - const handleRefetchQueries = (state: string) => { + const handleRefetchQueries = (state: string, bookUuid?: string) => { switch (state) { case 'mypage': queryClient.refetchQueries(['get-my-lecueBook'], { @@ -16,7 +16,7 @@ const usePostFavorite = (state: string) => { break; case 'lecueBookDetail': - queryClient.refetchQueries(['get-bookDetail-login'], { + queryClient.refetchQueries(['get-bookDetail-login', bookUuid], { exact: true, }); break; @@ -29,7 +29,7 @@ const usePostFavorite = (state: string) => { }, onError: () => navigate('/error'), onSuccess: () => { - handleRefetchQueries(state); + handleRefetchQueries(state, bookUuid); }, }); return mutation.mutate; From b01db9eb08bbfc446b7912b55865435301619468 Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Tue, 7 May 2024 19:46:07 +0900 Subject: [PATCH 08/10] =?UTF-8?q?fix:=20=EC=9D=B4=EB=AF=B8=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EB=90=9C=20=EB=A0=88=ED=81=90=EB=B6=81=EC=97=90=20?= =?UTF-8?q?=ED=95=9C=ED=95=B4=20=EB=84=98=EC=B9=9C=20=EA=B8=80=EC=9E=90?= =?UTF-8?q?=EC=88=98=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BookInfoBox/BookInfoBox.style.ts | 12 +++++++++++- src/Detail/components/BookInfoBox/index.tsx | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Detail/components/BookInfoBox/BookInfoBox.style.ts b/src/Detail/components/BookInfoBox/BookInfoBox.style.ts index dfc2d363..4999ee61 100644 --- a/src/Detail/components/BookInfoBox/BookInfoBox.style.ts +++ b/src/Detail/components/BookInfoBox/BookInfoBox.style.ts @@ -66,12 +66,18 @@ export const BookInfoHeaderItem = styled.p<{ backgroundColor: string }>` ${({ theme }) => theme.fonts.E_Caption_R_12}; `; -export const BookInfoTitle = styled.p<{ backgroundColor: string }>` +export const BookInfoTitle = styled.div` display: flex; gap: 0.5rem; align-items: center; margin-top: 0.7rem; +`; + +export const BookInfoTitleText = styled.p<{ backgroundColor: string }>` + max-width: 16.3rem; + + overflow: hidden; color: ${({ theme, backgroundColor }) => { backgroundColor; @@ -82,7 +88,11 @@ export const BookInfoTitle = styled.p<{ backgroundColor: string }>` return theme.colors.BG; } }}; + ${({ theme }) => theme.fonts.Head2_SB_18}; + + white-space: nowrap; + text-overflow: ellipsis; `; export const BookInfoContent = styled.p<{ backgroundColor: string }>` diff --git a/src/Detail/components/BookInfoBox/index.tsx b/src/Detail/components/BookInfoBox/index.tsx index 3a597a81..4c9a8d02 100644 --- a/src/Detail/components/BookInfoBox/index.tsx +++ b/src/Detail/components/BookInfoBox/index.tsx @@ -67,8 +67,10 @@ function BookInfoBox({ - - {title} + + + {title} + {isLogin && (isFavorite ? ( From 5c6e15d70e717a78c208e835ade48e06860438db Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Wed, 8 May 2024 22:30:25 +0900 Subject: [PATCH 09/10] =?UTF-8?q?fix:=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Detail/components/BookInfoBox/index.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Detail/components/BookInfoBox/index.tsx b/src/Detail/components/BookInfoBox/index.tsx index 4c9a8d02..82a3069d 100644 --- a/src/Detail/components/BookInfoBox/index.tsx +++ b/src/Detail/components/BookInfoBox/index.tsx @@ -33,7 +33,7 @@ function BookInfoBox({ bookId, bookUuid, }: BookInfoBoxProps) { - const token = window.localStorage.getItem('token'); + const token = localStorage.getItem('token'); const [isLogin, setIsLogin] = useState(false); const postFavoriteMutation = usePostFavorite('lecueBookDetail', bookUuid); @@ -71,16 +71,11 @@ function BookInfoBox({ {title} - {isLogin && - (isFavorite ? ( - - - - ) : ( - - - - ))} + {isLogin && ( + + {isFavorite ? : } + + )} {description} From 99c9aa0f75cef03dd2e107410425d5d89bd3def5 Mon Sep 17 00:00:00 2001 From: Doyun Lee Date: Sat, 11 May 2024 17:07:45 +0900 Subject: [PATCH 10/10] =?UTF-8?q?fix:=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Detail/api/getBookDetailLogin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Detail/api/getBookDetailLogin.ts b/src/Detail/api/getBookDetailLogin.ts index 6606dec8..1505d2a4 100644 --- a/src/Detail/api/getBookDetailLogin.ts +++ b/src/Detail/api/getBookDetailLogin.ts @@ -1,7 +1,7 @@ import { api } from '../../libs/api'; export async function getBookDetailLogin(bookUuid: string) { - const token = window.localStorage.getItem('token'); + const token = localStorage.getItem('token'); const data = await api.get(`/api/books/favorite/${bookUuid}`, { headers: { 'Content-Type': 'application/json',