feat: CreateArticle textarea input 반응형 크기 기능 추가

This commit is contained in:
정기영 2024-07-23 12:19:32 +09:00
parent 6873b2a4c6
commit d2b421cea8
5 changed files with 46 additions and 2 deletions

View File

@ -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

View File

@ -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;

View 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;
}

View 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;
}

View 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;
}