From dba3d52e99b9f2194ed01ab48f7bf80c73648e0d Mon Sep 17 00:00:00 2001 From: hae-on Date: Thu, 9 Nov 2023 20:12:40 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20input=20=ED=99=95=EB=8C=80=20?= =?UTF-8?q?=ED=98=84=EC=83=81=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Recipe/CommentForm/CommentForm.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/Recipe/CommentForm/CommentForm.tsx b/frontend/src/components/Recipe/CommentForm/CommentForm.tsx index 10465755..2a3756bf 100644 --- a/frontend/src/components/Recipe/CommentForm/CommentForm.tsx +++ b/frontend/src/components/Recipe/CommentForm/CommentForm.tsx @@ -98,7 +98,6 @@ const Form = styled.form` const CommentTextarea = styled(Textarea)` height: 50px; padding: 8px; - font-size: 1.4rem; `; const SubmitButton = styled(Button)` From 82c04c0b021a50eed8f1cb4af0e09f8e3d5b6046 Mon Sep 17 00:00:00 2001 From: hae-on Date: Fri, 10 Nov 2023 00:09:01 +0900 Subject: [PATCH 2/5] =?UTF-8?q?refactor:=20=ED=83=9C=EA=B7=B8=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=EB=8B=A4=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EA=B2=8C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Review/ReviewTagItem/ReviewTagItem.tsx | 1 + .../Review/ReviewTagList/ReviewTagList.tsx | 24 +------------------ frontend/src/contexts/ReviewFormContext.tsx | 3 +++ 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx b/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx index 7ca589fc..22554661 100644 --- a/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx +++ b/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx @@ -18,6 +18,7 @@ const ReviewTagItem = ({ id, name, variant, isSelected }: ReviewTagItemProps) => const handleReviewTag = () => { handleReviewFormValue({ target: 'tagIds', value: id, isSelected }); + console.log({ target: 'tagIds', value: id, isSelected }); }; return ( diff --git a/frontend/src/components/Review/ReviewTagList/ReviewTagList.tsx b/frontend/src/components/Review/ReviewTagList/ReviewTagList.tsx index 54c717be..e3b3ca5d 100644 --- a/frontend/src/components/Review/ReviewTagList/ReviewTagList.tsx +++ b/frontend/src/components/Review/ReviewTagList/ReviewTagList.tsx @@ -3,10 +3,8 @@ import styled from 'styled-components'; import ReviewTagItem from '../ReviewTagItem/ReviewTagItem'; -import { SvgIcon } from '@/components/Common'; import { MIN_DISPLAYED_TAGS_LENGTH, TAG_TITLE } from '@/constants'; import { useReviewTagsQuery } from '@/hooks/queries/review'; -import { useDisplayTag } from '@/hooks/review'; interface ReviewTagListProps { selectedTags: number[]; @@ -14,7 +12,6 @@ interface ReviewTagListProps { const ReviewTagList = ({ selectedTags }: ReviewTagListProps) => { const { data: tagsData } = useReviewTagsQuery(); - const { minDisplayedTags, canShowMore, showMoreTags } = useDisplayTag(tagsData, MIN_DISPLAYED_TAGS_LENGTH); return ( @@ -31,7 +28,7 @@ const ReviewTagList = ({ selectedTags }: ReviewTagListProps) => {
    - {tags.slice(0, minDisplayedTags).map(({ id, name }) => ( + {tags.map(({ id, name }) => ( <>
  • @@ -43,20 +40,6 @@ const ReviewTagList = ({ selectedTags }: ReviewTagListProps) => { ))} - - {canShowMore && ( - - )} ); }; @@ -107,8 +90,3 @@ const TagItemWrapper = styled.div` const TagTitle = styled(Heading)` text-align: center; `; - -const SvgWrapper = styled.span` - display: inline-block; - transform: rotate(270deg); -`; diff --git a/frontend/src/contexts/ReviewFormContext.tsx b/frontend/src/contexts/ReviewFormContext.tsx index 34c15659..68c6730d 100644 --- a/frontend/src/contexts/ReviewFormContext.tsx +++ b/frontend/src/contexts/ReviewFormContext.tsx @@ -1,3 +1,4 @@ +import { useToastActionContext } from '@fun-eat/design-system'; import type { PropsWithChildren } from 'react'; import { createContext, useState } from 'react'; @@ -27,6 +28,7 @@ export const ReviewFormActionContext = createContext(nu const ReviewFormProvider = ({ children }: PropsWithChildren) => { const [reviewFormValue, setReviewFormValue] = useState(initialReviewFormValue); + const { toast } = useToastActionContext(); const handleReviewFormValue = ({ target, value, isSelected }: ReviewFormActionParams) => { setReviewFormValue((prev) => { @@ -34,6 +36,7 @@ const ReviewFormProvider = ({ children }: PropsWithChildren) => { if (Array.isArray(targetValue)) { if (targetValue.length >= MIN_DISPLAYED_TAGS_LENGTH && !isSelected) { + toast.success(`태그는 ${MIN_DISPLAYED_TAGS_LENGTH}까지 선택할 수 있습니다`); return prev; } From edd44c3d41e0692a742540ef102bf2a18ec99edf Mon Sep 17 00:00:00 2001 From: hae-on Date: Fri, 10 Nov 2023 00:09:55 +0900 Subject: [PATCH 3/5] =?UTF-8?q?chore:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20hook=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/review/index.ts | 1 - frontend/src/hooks/review/useDisplayTag.ts | 21 --------------------- 2 files changed, 22 deletions(-) delete mode 100644 frontend/src/hooks/review/useDisplayTag.ts diff --git a/frontend/src/hooks/review/index.ts b/frontend/src/hooks/review/index.ts index a91a7a68..afebf1bd 100644 --- a/frontend/src/hooks/review/index.ts +++ b/frontend/src/hooks/review/index.ts @@ -1,2 +1 @@ -export { default as useDisplayTag } from './useDisplayTag'; export { default as useStarRatingHover } from './useStarRatingHover'; diff --git a/frontend/src/hooks/review/useDisplayTag.ts b/frontend/src/hooks/review/useDisplayTag.ts deleted file mode 100644 index 153ab290..00000000 --- a/frontend/src/hooks/review/useDisplayTag.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { useState } from 'react'; - -import type { ReviewTag } from '@/types/review'; - -const getMaxTagsInGroup = (tagList: ReviewTag[]) => { - return tagList.reduce((max, { tags }) => Math.max(max, tags.length), 0); -}; - -const useDisplayTag = (initialReviewTagList: ReviewTag[], minDisplayedTagsLength: number) => { - const [minDisplayedTags, setMinDisplayedTags] = useState(minDisplayedTagsLength); - - const canShowMore = minDisplayedTags < getMaxTagsInGroup(initialReviewTagList); - - const showMoreTags = () => { - setMinDisplayedTags(getMaxTagsInGroup(initialReviewTagList)); - }; - - return { minDisplayedTags, canShowMore, showMoreTags }; -}; - -export default useDisplayTag; From 59f798191e59ed747bfcf512e628a0b98b810269 Mon Sep 17 00:00:00 2001 From: hae-on Date: Sun, 19 Nov 2023 22:35:58 +0900 Subject: [PATCH 4/5] =?UTF-8?q?chore:=20=EB=B9=A0=EC=A7=84=20=EA=B8=80?= =?UTF-8?q?=EC=9E=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/contexts/ReviewFormContext.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/contexts/ReviewFormContext.tsx b/frontend/src/contexts/ReviewFormContext.tsx index 68c6730d..8be4fb1f 100644 --- a/frontend/src/contexts/ReviewFormContext.tsx +++ b/frontend/src/contexts/ReviewFormContext.tsx @@ -36,7 +36,7 @@ const ReviewFormProvider = ({ children }: PropsWithChildren) => { if (Array.isArray(targetValue)) { if (targetValue.length >= MIN_DISPLAYED_TAGS_LENGTH && !isSelected) { - toast.success(`태그는 ${MIN_DISPLAYED_TAGS_LENGTH}까지 선택할 수 있습니다`); + toast.success(`태그는 ${MIN_DISPLAYED_TAGS_LENGTH}개까지 선택할 수 있습니다`); return prev; } From 4931fdbb14332c3be1a0a79aac323d40a6cd6e64 Mon Sep 17 00:00:00 2001 From: hae-on Date: Sun, 19 Nov 2023 22:36:05 +0900 Subject: [PATCH 5/5] =?UTF-8?q?chore:=20console=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx b/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx index 22554661..7ca589fc 100644 --- a/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx +++ b/frontend/src/components/Review/ReviewTagItem/ReviewTagItem.tsx @@ -18,7 +18,6 @@ const ReviewTagItem = ({ id, name, variant, isSelected }: ReviewTagItemProps) => const handleReviewTag = () => { handleReviewFormValue({ target: 'tagIds', value: id, isSelected }); - console.log({ target: 'tagIds', value: id, isSelected }); }; return (