-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] 토론 피드 상세 모달 읽기 전용 UI 구현 (#27)
* [feat] added FeedWrapper Component - FeedWrapper depends on whether there is pathname value "p" or not - If pathname "p" value of browser navigation is existed, FeedWrapper render children props * [fix] fixed commit error - The folder name included "@" caused error when committing - The folder name to start "@" means slot router * [feat] added compactTimeFormatter util for feed created time * [feat] added FeedWrapper, ReadOnlyCommonFeed, FeedTextContent Component - FeedWrapper depends on whether or not browser navigation has value of key "f" - ReadOnlyCommonFeed is only rendering from props information about common feed - FeedTextContent is rendering feed information (profile, content, username etc.) * [style] added "flex-wrap: wrap;" style at .hashtag_wrapper in FeedTextContent Component * [feat] added FeedComment, FeedCommentList - not included server request logic * [feat] added FeedLikeBox Component and svg heart icon * [feat] added LikeButton Component * [feat] added FeedCommentWriteInput Component and useAutoResizeTextArea hook * [feat] added Slide Component - added height, maxHeight props at Modal Component * [feat] added FeedReplyWriteInput Component - update useAutoResizeTextArea hook (not use row count, use scrollHeight) * [feat] added ReadOnlyDebateFeed Component * [feat] added DebateContent Component * [feat] completed ReadOnlyDebateFeed Component and Refactoring
- Loading branch information
1 parent
5b8eb6a
commit 2f3076e
Showing
23 changed files
with
545 additions
and
78 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/app/(MainLayout)/components/DebateContent/DebateContent.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/app/(MainLayout)/components/DebateContent/DebateContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className={styles.container}> | ||
<div className={clsx(styles.debate_container, currentColor)}> | ||
<h2>{optionContent}</h2> | ||
<div className={styles.vote_count}> | ||
{isSelected ? <FLAG.FILL /> : <FLAG.NORMAL />} | ||
{digitNumberFormatter(voteCount)} | ||
</div> | ||
<div | ||
className={clsx(styles.vote, currentColor)} | ||
style={{ width: `${ratio}%` }} | ||
/> | ||
</div> | ||
<div className={styles.comment_container}> | ||
<FeedCommentList | ||
feedId={postId.toString()} | ||
feedCommentIds={['1', '2', '3']} | ||
/> | ||
</div> | ||
<div> | ||
<FeedCommentWriteInput | ||
postId={1} | ||
placeholder={ | ||
disabled | ||
? '댓글 달기...' | ||
: '다른 의견에 동의하셔서 입력하실 수 없습니다.' | ||
} | ||
disabled={!disabled} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DebateContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './DebateContent'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 14 additions & 17 deletions
31
src/app/(MainLayout)/components/LikeButton/LikeButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.