Skip to content

Commit

Permalink
[FE] fix: 섹션별 답변 모아보기의 중복 출력 문제 해결 및 리스트 형식으로 출력 (#821)
Browse files Browse the repository at this point in the history
* fix: 받은 리뷰가 중복되어 표시되는 오류 수정

* design: 형광펜 에디터가 답변을 list 형태로 출력하도록 설정

* design: 답변 간 간격 설정
  • Loading branch information
chysis authored Oct 11, 2024
1 parent 046b230 commit 1f02630
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/highlight/EditorLineBlock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { EditorLine, HighlightRange } from '@/types';

import Syntax from '../Syntax';

import * as S from './style';

interface EditorLineBlockProps {
line: EditorLine;
lineIndex: number;
Expand Down Expand Up @@ -60,9 +62,9 @@ const EditorLineBlock = ({ line, lineIndex }: EditorLineBlockProps) => {
};

return (
<p className={EDITOR_LINE_CLASS_NAME} data-index={lineIndex}>
<S.EditorLineBlock className={EDITOR_LINE_CLASS_NAME} data-index={lineIndex}>
{renderSentenceList()}
</p>
</S.EditorLineBlock>
);
};

Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/highlight/EditorLineBlock/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from '@emotion/styled';

export const EditorLineBlock = styled.p`
display: list-item;
margin-left: 3rem;
text-indent: -2.2rem;
list-style-type: disc;
`;
4 changes: 2 additions & 2 deletions frontend/src/components/highlight/HighlightEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const HighlightEditor = ({ questionId, answerList }: HighlightEditorProps) => {
}, [isEditable]);

return (
<div ref={editorRef} style={{ position: 'relative' }}>
<S.HighlightEditorContainer ref={editorRef}>
<S.SwitchButtonWrapper>
<EditSwitchButton isEditable={isEditable} handleEditToggleButton={handleEditToggleButton} />
</S.SwitchButtonWrapper>
Expand Down Expand Up @@ -120,7 +120,7 @@ const HighlightEditor = ({ questionId, answerList }: HighlightEditorProps) => {
{isEditable && removalTarget && removerPosition && (
<HighlightRemoverWrapper buttonPosition={removerPosition} removeHighlightByClick={removeHighlightByClick} />
)}
</div>
</S.HighlightEditorContainer>
);
};

Expand Down
10 changes: 10 additions & 0 deletions frontend/src/components/highlight/HighlightEditor/style.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import styled from '@emotion/styled';

export const HighlightEditorContainer = styled.div`
position: relative;
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
`;

export const SwitchButtonWrapper = styled.div`
display: flex;
justify-content: end;
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/pages/ReviewCollectionPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const ReviewCollectionPage = () => {
{review.answers && (
<HighlightEditor questionId={review.question.id} answerList={review.answers} />
)}
{review.answers?.map((answer, index) => {
return <S.ReviewAnswer key={index}>{answer.content}</S.ReviewAnswer>;
})}
</S.ReviewAnswerContainer>
)}
</Accordion>
Expand Down

0 comments on commit 1f02630

Please sign in to comment.