diff --git a/src/app/(MainLayout)/components/DebateContent/DebateContent.module.scss b/src/app/(MainLayout)/components/DebateContent/DebateContent.module.scss new file mode 100644 index 0000000..5038f4d --- /dev/null +++ b/src/app/(MainLayout)/components/DebateContent/DebateContent.module.scss @@ -0,0 +1,56 @@ +@use '../../../../styles/helpers/index' as *; + +.blue { + background-color: rgba(43, 89, 195, 0.3); +} + +.red { + background-color: rgba(211, 101, 130, 0.3); +} + +.container { + flex: 1; + border-right: 1px solid $COLOR_GRAY_2; + + &:last-of-type { + border-right: none; + } + + .debate_container { + position: relative; + height: 200px; + border-bottom: 1px solid $COLOR_GRAY_2; + + @include flex-center; + + h2 { + font-size: $FONT_SIZE_32; + font-weight: bold; + color: $COLOR_GRAY_2; + } + + .vote_count { + position: absolute; + top: 20px; + left: 20px; + gap: 5px; + + @include flex-center; + } + + .vote { + position: absolute; + width: 100%; + height: 200px; + top: 0; + left: 0; + opacity: 0.5; + border-right: 1px solid $COLOR_GRAY_2; + } + } + + .comment_container { + height: 539px; + overflow: scroll; + } +} diff --git a/src/app/(MainLayout)/components/DebateContent/DebateContent.tsx b/src/app/(MainLayout)/components/DebateContent/DebateContent.tsx new file mode 100644 index 0000000..7a25a11 --- /dev/null +++ b/src/app/(MainLayout)/components/DebateContent/DebateContent.tsx @@ -0,0 +1,84 @@ +import clsx from 'clsx'; + +import { digitNumberFormatter } from '@/utils/formatter'; + +import BlueFlag from '@/assets/icons/blue_flag.svg'; +import BlueFillFlag from '@/assets/icons/blue_flag_fill.svg'; +import RedFlag from '@/assets/icons/red_flag.svg'; +import RedFillFlag from '@/assets/icons/red_flag_fill.svg'; +import FeedCommentList from '../FeedCommentList'; + +import styles from './DebateContent.module.scss'; +import FeedCommentWriteInput from '../FeedCommentWriteInput'; +import { DebateOptionType } from '../../types/feed'; + +interface DebateContentProps { + postId: number; + index: number; + option: DebateOptionType; + isSelected?: boolean; + ratio: number; + disabled?: boolean; +} + +const FLAG_SET = { + BLUE: { + NORMAL: BlueFlag, + FILL: BlueFillFlag, + }, + RED: { + NORMAL: RedFlag, + FILL: RedFillFlag, + }, +}; + +const DebateContent = ({ + postId, + index, + option, + ratio, + isSelected, + disabled, +}: DebateContentProps) => { + const { optionContent, voteCount } = option; + + const currentFlagType = index === 1 ? 'BLUE' : ('RED' as const); + const FLAG = FLAG_SET[currentFlagType]; + + const currentColor = currentFlagType === 'BLUE' ? styles.blue : styles.red; + + return ( +
{nickname}
-{feedContent}
diff --git a/src/app/(MainLayout)/components/FeedCommentList/FeedCommentList.tsx b/src/app/(MainLayout)/components/FeedCommentList/FeedCommentList.tsx index ea3226e..d3bf7d1 100644 --- a/src/app/(MainLayout)/components/FeedCommentList/FeedCommentList.tsx +++ b/src/app/(MainLayout)/components/FeedCommentList/FeedCommentList.tsx @@ -20,6 +20,7 @@ const makeMockData = (id: number) => ({ createdAt: '2024-10-25 20:08:22', updatedAt: '2024-10-28 21:29:22', likeCount: 1357345 + id, + isLike: false, childFeedComments: +id < 4 ? [4, 5, 6] : [], }); diff --git a/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.module.scss b/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.module.scss index 6ffe10a..84a54c6 100644 --- a/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.module.scss +++ b/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.module.scss @@ -8,10 +8,21 @@ padding: 18px 0 18px 18px; border-top: 1px solid $COLOR_GRAY_2; + &:has(.comment_textarea:disabled) { + & * { + color: $COLOR_GRAY_2; + } + + .submit_button { + cursor: default; + } + } + .comment_textarea { flex: 1; - color: $COLOR_GRAY_2; + height: 20px; line-height: 1.25rem; + color: $COLOR_GRAY_2; white-space: pre-wrap; word-wrap: break-word; } diff --git a/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.tsx b/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.tsx index cfb7e02..ca60096 100644 --- a/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.tsx +++ b/src/app/(MainLayout)/components/FeedCommentWriteInput/FeedCommentWriteInput.tsx @@ -12,12 +12,14 @@ interface FeedCommentWriteInputProps { postId: number; parentId?: number; placeholder?: string; + disabled?: boolean; } const FeedCommentWriteInput = ({ postId, parentId, placeholder = '댓글 달기...', + disabled, }: FeedCommentWriteInputProps) => { const { textareaContent, setTextareaContent, textareaRef } = useAutoResizeTextArea({ maxLine: 3, lineHeight: 20 }); @@ -44,8 +46,13 @@ const FeedCommentWriteInput = ({ onChange={changeHandler} value={textareaContent} ref={textareaRef} + disabled={disabled} + /> + - diff --git a/src/app/(MainLayout)/components/FeedLikeBox/FeedLikeBox.tsx b/src/app/(MainLayout)/components/FeedLikeBox/FeedLikeBox.tsx index 08e243b..6fc8874 100644 --- a/src/app/(MainLayout)/components/FeedLikeBox/FeedLikeBox.tsx +++ b/src/app/(MainLayout)/components/FeedLikeBox/FeedLikeBox.tsx @@ -9,14 +9,20 @@ interface FeedLikeBoxProps { postId: number; likeCount: number; commentCount: number; + isLike: boolean; } -const FeedLikeBox = ({ postId, likeCount, commentCount }: FeedLikeBoxProps) => { +const FeedLikeBox = ({ + postId, + likeCount, + commentCount, + isLike, +}: FeedLikeBoxProps) => { return ({username}
-- {compactTimeFormatter(updatedAt ?? createdAt)} -
+{userName}
+{compactTimeFormatter(createdAt)}
{content}
#{hashtag}
))}