-
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] added FeedReplyWriteInput Component
- update useAutoResizeTextArea hook (not use row count, use scrollHeight)
- Loading branch information
1 parent
07a86f1
commit 49218d4
Showing
10 changed files
with
183 additions
and
89 deletions.
There are no files selected for viewing
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
11 changes: 7 additions & 4 deletions
11
src/app/(MainLayout)/components/FeedCommentList/FeedCommentList.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
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
29 changes: 29 additions & 0 deletions
29
src/app/(MainLayout)/components/FeedReplyWriteInput/FeedReplyWriteInput.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,29 @@ | ||
@use '../../../../styles/helpers/index' as *; | ||
|
||
.container { | ||
display: flex; | ||
align-items: center; | ||
height: auto; | ||
margin: 10px 0; | ||
border: 1px solid $COLOR_GRAY_2; | ||
border-radius: 5px; | ||
|
||
textarea { | ||
flex: 1; | ||
height: 20px; | ||
margin: 10px; | ||
margin-right: 0; | ||
white-space: pre-wrap; | ||
word-break: break-all; | ||
line-height: 20px; | ||
} | ||
|
||
button { | ||
height: 100%; | ||
padding: 0.5rem 1rem; | ||
border-radius: 2px; | ||
text-align: center; | ||
color: $COLOR_PRIMARY_1; | ||
cursor: pointer; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/app/(MainLayout)/components/FeedReplyWriteInput/FeedReplyWriteInput.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,38 @@ | ||
'use client'; | ||
|
||
import { ChangeEvent } from 'react'; | ||
|
||
import useAutoResizeTextArea from '@/hooks/useAutoResizeTextArea'; | ||
|
||
import styles from './FeedReplyWriteInput.module.scss'; | ||
|
||
interface FeedReplyWriteInputProps { | ||
commentId: string; | ||
} | ||
|
||
const FeedReplyWriteInput = ({ commentId }: FeedReplyWriteInputProps) => { | ||
const { textareaRef, textareaContent, setTextareaContent } = | ||
useAutoResizeTextArea({ maxLine: 3, lineHeight: 20 }); | ||
|
||
const textareaChangeHandler = (e: ChangeEvent<HTMLTextAreaElement>) => { | ||
const { value } = e.target; | ||
setTextareaContent(value); | ||
}; | ||
|
||
const replySubmitHandler = () => { | ||
console.log(commentId, textareaContent); | ||
}; | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<textarea | ||
ref={textareaRef} | ||
value={textareaContent} | ||
onChange={textareaChangeHandler} | ||
/> | ||
<button onClick={replySubmitHandler}>게시</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FeedReplyWriteInput; |
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 './FeedReplyWriteInput'; |
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