Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5024f5c
:sparkles: feat : 피드 헤더 레이아웃 구현
Dec 14, 2024
2372391
:lipstick: chore : 공유하기 버튼 svg 스타일링
Dec 14, 2024
3db96a1
:white_check_mark: chore : 프로필 사진 및 이름 불러오는 handleLoad 함수 구현(테스트용)
Dec 14, 2024
4585c65
:bento: chore : 헤더이미지파일 추가 및 코드 수정
Dec 15, 2024
39c91cf
:lipstick: chore : PR 리뷰 내용 반영하여 스타일 수정
Dec 15, 2024
dc77f77
:twisted_rightward_arrows: chore : feat/헤더_레이아웃을 epic/Answer_화면_구현으로 …
Dec 15, 2024
8ba225d
:sparkles: feat : URL 복사 알림용 토스트 구현 시작
Dec 15, 2024
d53c802
:lipstick: chore : 토스트 기본 레이아웃 구현
Dec 15, 2024
c03bb9f
:sparkles: chore : URL버튼 클릭시 클립보드에 현재 URL 복사하는 handleCopyUrl추가 및 onCl…
Dec 15, 2024
2bc9a0f
:sparkles: chore : npm prop types 다운로드, 링크 복사 버튼 클릭 시 토스트 메시지 보여주는 동작 구현
Dec 15, 2024
e0ca7f6
:lipstick: chore : 토스트 애니메이션 효과 구현, tailwind.config.js 수정
Dec 16, 2024
d6b016a
:lipstick: chore : 토스트 애니메이션 개선 및 tailwind.config.js 수정
Dec 17, 2024
a18ff84
:sparkles: feat : 삭제하기 버튼 기본 레이아웃 및 스타일 작업
Dec 18, 2024
b2efb23
Merge branch 'merge' into feat/삭제하기_버튼_구현
Dec 18, 2024
8e2c0c5
:sparkles: feat : 삭제하기 버튼 클릭 시 로컬id 삭제 및 루트로 이동 기능
Dec 18, 2024
e779909
:truck: chore : toast 컴포넌트 및 파일 이름을 toastUrlCopy로 변경
Dec 18, 2024
c2d9dc8
:sparkles: feat : 삭제하기 버튼 클릭 시 삭제 완료 안내 토스트 구현
Dec 18, 2024
91ae4f0
:art: chore : 토스트 애니메이션 동작 시간 수정 and :bug: fixed : 프로필 사진 렌더링 시 src 오…
Dec 18, 2024
cc07fd7
Merge branch 'epic/Answer_화면_구현' into feat/삭제하기_버튼_구현
junAlexx Dec 18, 2024
6408b4f
:bug: fixed: prettier 문제로 발생한 빌드 오류 수정에 관한 커밋
Dec 18, 2024
836e30d
:truck: chore : 첫글자 소문자로 적은 폴더 이름 대문자로 변경, 기존 toast 컴포넌트와 폴더 이름을 toa…
Dec 18, 2024
ddb9f35
:truck: chore : 로컬에서 폴더명을 수정했으나 원격에서 인식하지 못해 다시 원상복구 시키는 커밋입니다.
Dec 18, 2024
f50d4b8
Merge branch 'feat/삭제하기_버튼_구현' into epic/Answer_화면_구현
Dec 18, 2024
746131b
Merge branch 'epic/Answer_화면_구현' of https://github.com/codeit-part2-p…
Dec 19, 2024
8532805
Merge branch 'epic/Answer_화면_구현' of https://github.com/codeit-part2-p…
Dec 21, 2024
3bd91d5
:sparkles: feat : 답변 등록 구현
Dec 22, 2024
a3d7264
Merge branch 'epic/Answer_화면_구현' of https://github.com/codeit-part2-p…
Dec 22, 2024
6c12ba0
:sparkles: feat : 케밥 답변삭제 구현
Dec 22, 2024
5d66a5e
Merge branch 'epic/Answer_화면_구현' into feat/케밥_답변삭제_구현
Dec 22, 2024
f7ce970
✨ feat : 질문삭제 컴포넌트로 분리
LMS10 Dec 22, 2024
b95931e
✨ feat : 질문삭제 컴포넌트 구현
LMS10 Dec 22, 2024
14df884
:sparkles: feat : 답변 삭제 버튼 클릭 시 원래 상태로 렌더링 되는 기능 구현
Dec 22, 2024
c9f90ae
:recycle: chore : textarea 초기화
ToKyun02 Dec 22, 2024
3d40cae
:twisted_rightwards_arrows: merge : feat/케밥_답변삭제_구현
ToKyun02 Dec 22, 2024
4d2f464
:sparkles: feat : 케밥 답변거절 구현
ToKyun02 Dec 23, 2024
c6be52b
:twisted_rightwards_arrows: merge : epic/Answer_화면_구현 충돌 해결
ToKyun02 Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/AnswerContent/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const AnswerContent = ({ answer, name, imageSource, id, onAnswerSubmit }) => {
imageSource: 'https://fastly.picsum.photos/id/772/200/200.jpg?hmac=9euSj4JHTPr7uT5QWVmeNJ8JaqAXY8XmJnYfr_DfBJc',
};

// if (answer) {
// console.log(answer);
// }

const location = useLocation();
const [textareaValue, setTextareaValue] = useState('');
const [updatedAnswer, setUpdatedAnswer] = useState(answer);
Expand Down
58 changes: 58 additions & 0 deletions src/components/AnswerRejection/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import PropTypes from 'prop-types';
import { useState } from 'react';
import { postAnswer } from 'api/answers';
import { ReactComponent as Rejection } from 'assets/images/icons/ic_Rejection.svg';

const AnswerRejection = ({ id, setQuestionList }) => {
AnswerRejection.propTypes = {
id: PropTypes.number.isRequired,
setQuestionList: PropTypes.func.isRequired,
};

const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);

const handleRejection = async () => {
const defaultContent = 'reject';
try {
setIsLoading(true);
setError(null);

const result = await postAnswer(id, {
content: defaultContent,
isRejected: true,
});

setQuestionList((prevQuestions) =>
prevQuestions.map((question) => {
if (question.id === id) {
return { ...question, answer: result };
}
return question;
}),
);
} catch (err) {
setError('답변 거절 중 오류가 발생했습니다.');
} finally {
setIsLoading(false);
}
};

if (error) {
return <div>에러: {error}</div>;
}

return (
<button
type='button'
className='flex justify-center items-center gap-2 rounded-lg w-[103px] h-[30px] text-gray-50 hover:text-gray-60 hover:bg-gray-20'
onClick={handleRejection}
disabled={isLoading}
>
<Rejection className='w-3.5 h-3.5 fill-current' />
답변거절
</button>
);
};

export default AnswerRejection;
10 changes: 4 additions & 6 deletions src/components/Kebab/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import PropTypes from 'prop-types';
import { useEffect, useRef } from 'react';
import QuestionDelete from 'components/QuestionDelete';
import AnswerRejection from 'components/AnswerRejection';
import kebab from 'assets/images/icons/ic_Kebab.svg';
import { ReactComponent as Rejection } from 'assets/images/icons/ic_Rejection.svg';
import { ReactComponent as Edit } from 'assets/images/icons/ic_Edit.svg';
import AnswerDelete from 'components/AnswerDelete';

const Kebab = ({ id, isAnswer, isKebabOpen, onKebabClick, onDeleteQuestion, onAnswerDeleted }) => {
const Kebab = ({ id, isAnswer, isKebabOpen, onKebabClick, onDeleteQuestion, onAnswerDeleted, setQuestionList }) => {
Kebab.propTypes = {
id: PropTypes.number.isRequired,
isAnswer: PropTypes.shape({
Expand All @@ -20,6 +20,7 @@ const Kebab = ({ id, isAnswer, isKebabOpen, onKebabClick, onDeleteQuestion, onAn
onKebabClick: PropTypes.func.isRequired,
onDeleteQuestion: PropTypes.func.isRequired,
onAnswerDeleted: PropTypes.func.isRequired,
setQuestionList: PropTypes.func.isRequired,
};

const menuRef = useRef(null);
Expand Down Expand Up @@ -59,10 +60,7 @@ const Kebab = ({ id, isAnswer, isKebabOpen, onKebabClick, onDeleteQuestion, onAn
{!isAnswer ? (
<>
<div className='flex justify-center items-center rounded-lg'>
<button type='button' className='flex justify-center items-center gap-2 rounded-lg w-[103px] h-[30px] text-gray-50 hover:text-gray-60 hover:bg-gray-20'>
<Rejection className='w-3.5 h-3.5 fill-current' />
<p>답변거절</p>
</button>
<AnswerRejection id={id} setQuestionList={setQuestionList} />
</div>
<div className='flex justify-center items-center'>
<QuestionDelete id={id} onDeleteQuestion={onDeleteQuestion} />
Expand Down
1 change: 1 addition & 0 deletions src/components/QnAList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const QnAList = ({ name, imageSource, questionList, setQuestionList, onDeleteQue
onClick={handleDeleteQuestion}
onDeleteQuestion={handleDeleteQuestion}
onAnswerDeleted={handleAnswerDeleted}
setQuestionList={setQuestionList}
/>
)}
</div>
Expand Down
Loading