feat: CreateArticle textarea input 반응형 크기 기능 추가
This commit is contained in:
parent
6873b2a4c6
commit
d2b421cea8
@ -16,6 +16,12 @@ export default function CreateArticle({ topic, title, backPath = '/' }) {
|
||||
}
|
||||
};
|
||||
// TODO: 입력 크기에 따라 반응형으로 textarea 크기 변경
|
||||
const handleInput = (e) => {
|
||||
setArticleContent(e.target.value);
|
||||
// 높이를 자동으로 조정
|
||||
e.target.style.height = 'auto';
|
||||
e.target.style.height = e.target.scrollHeight + 'px';
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.createArticle}>
|
||||
@ -51,7 +57,7 @@ export default function CreateArticle({ topic, title, backPath = '/' }) {
|
||||
className={styles.contentInput}
|
||||
placeholder="내용을 입력하세요"
|
||||
value={articleContent}
|
||||
onChange={(e) => setArticleContent(e.target.value)}
|
||||
onChange={handleInput}
|
||||
></textarea>
|
||||
</div>
|
||||
<button
|
||||
|
@ -59,7 +59,9 @@
|
||||
|
||||
.contentInput {
|
||||
padding: 20px;
|
||||
height: 150px;
|
||||
height: 80px;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
background: var(--background-color);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
|
12
frontend/src/hooks/api/useNotice.js
Normal file
12
frontend/src/hooks/api/useNotice.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import instance from '../../utils/axios/instance';
|
||||
import { API_URL } from '../../constants';
|
||||
|
||||
export function useNotice({ lectureId, noticeId }) {
|
||||
const response = useQuery({
|
||||
queryKey: ['notice', lectureId, noticeId],
|
||||
queryFn: instance.get(`${API_URL}/notice/${lectureId}/${noticeId}`),
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
12
frontend/src/hooks/api/useQuestion.js
Normal file
12
frontend/src/hooks/api/useQuestion.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import instance from '../../utils/axios/instance';
|
||||
import { API_URL } from '../../constants';
|
||||
|
||||
export function useQuestion({ lectureId, qusetionId }) {
|
||||
const response = useQuery({
|
||||
queryKey: ['question', lectureId, qusetionId],
|
||||
queryFn: instance.get(`${API_URL}/qna/${lectureId}/${qusetionId}`),
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
12
frontend/src/hooks/api/useQusetions.js
Normal file
12
frontend/src/hooks/api/useQusetions.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import instance from '../../utils/axios/instance';
|
||||
import { API_URL } from '../../constants';
|
||||
|
||||
export function useQuestions(lectureId) {
|
||||
const response = useQuery({
|
||||
queryKey: ['questionlist', lectureId],
|
||||
queryFn: instance.get(`${API_URL}/qna/${lectureId}`),
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
Loading…
Reference in New Issue
Block a user