Skip to content

Commit f26edb5

Browse files
committed
🛠️ refactor: (FE) - feedback 관련 컴포넌트 구조 및 이름 변경
1 parent 19ff84e commit f26edb5

File tree

8 files changed

+61
-87
lines changed

8 files changed

+61
-87
lines changed

frontend/src/components/FeedbackArea/FeedbackArea.style.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

frontend/src/components/EditableFeedbackBox/EditableFeedbackBox.style.ts renamed to frontend/src/components/FeedbackItem/FeedbackItem.style.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css } from '@emotion/react';
22

3-
export const feedbackBoxStyle = (theme) => css`
3+
export const feedbackBoxStyle = css`
44
display: flex;
55
gap: 10px;
66
position: relative;
@@ -16,16 +16,6 @@ export const fbTextAreaStyle = (theme) => css`
1616
box-sizing: border-box;
1717
`;
1818

19-
export const fbBtnContainer = css`
20-
position: absolute;
21-
right: 10px;
22-
height: 100%;
23-
padding: 5px 0px;
24-
display: flex;
25-
flex-direction: column;
26-
justify-content: space-between;
27-
`;
28-
2919
export const fbStartTimeStyle = (theme) => css`
3020
width: 30px;
3121
height: 15px;

frontend/src/components/EditableFeedbackBox/EditableFeedbackBox.tsx renamed to frontend/src/components/FeedbackItem/FeedbackItem.tsx

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,8 @@ import useCrudFeedback from '@hooks/useCrudFeedback';
55
import { isFbClickedState, isFbSyncState } from '@store/feedback.store';
66
import { currentVideoTimeState } from '@store/currentVideoTime.store';
77

8-
import { ReactComponent as DeleteIcon } from '@assets/icon/delete.svg';
9-
import { ReactComponent as EditIcon } from '@assets/icon/edit.svg';
10-
import { ReactComponent as CheckIcon } from '@assets/icon/check.svg';
11-
import {
12-
feedbackBoxStyle,
13-
fbTextAreaStyle,
14-
fbBtnContainer,
15-
fbStartTimeStyle,
16-
} from './EditableFeedbackBox.style';
17-
import { iconSmStyle } from '@styles/commonStyle';
8+
import { feedbackBoxStyle, fbTextAreaStyle, fbStartTimeStyle } from './FeedbackItem.style';
9+
1810
import { FeedbackItemType } from '@customType/feedback';
1911

2012
interface PropsType {
@@ -23,13 +15,12 @@ interface PropsType {
2315
feedbackRef: React.MutableRefObject<any[]>;
2416
index: number;
2517
}
26-
const EditableFeedbackBox = ({ feedback, feedbackRef, index }: PropsType) => {
18+
const FeedbackItem = ({ feedback, feedbackRef, index }: PropsType) => {
2719
const textareaRef = useRef<HTMLTextAreaElement>(null);
2820
const isFbSync = useRecoilValue(isFbSyncState);
2921
const setIsFbClicked = useSetRecoilState(isFbClickedState);
3022
const setCurrentVideoTime = useSetRecoilState(currentVideoTimeState);
31-
const { handleStartEditFeedback, handleEndEditFeedback, handleFbChange, handleDeleteFeedback } =
32-
useCrudFeedback(feedback.id);
23+
const { handleFbChange } = useCrudFeedback(feedback.id);
3324

3425
useEffect(() => {
3526
feedbackRef.current[index].style.height = textareaRef.current.scrollHeight + 'px';
@@ -56,22 +47,8 @@ const EditableFeedbackBox = ({ feedback, feedbackRef, index }: PropsType) => {
5647
onClick={handleClickFeedback}
5748
css={fbTextAreaStyle}
5849
/>
59-
<div css={fbBtnContainer}>
60-
{readOnly ? (
61-
<button onClick={handleStartEditFeedback}>
62-
<EditIcon {...iconSmStyle} fill="black" />
63-
</button>
64-
) : (
65-
<button onClick={handleEndEditFeedback}>
66-
<CheckIcon {...iconSmStyle} fill="black" />
67-
</button>
68-
)}
69-
<button onClick={handleDeleteFeedback}>
70-
<DeleteIcon {...iconSmStyle} fill="black" />
71-
</button>
72-
</div>
7350
</div>
7451
);
7552
};
7653

77-
export default React.memo(EditableFeedbackBox);
54+
export default React.memo(FeedbackItem);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { css } from '@emotion/react';
2+
3+
export const feedbackListStyle = css`
4+
overflow: scroll;
5+
display: flex;
6+
flex-direction: column;
7+
height: 70%;
8+
gap: 10px;
9+
`;
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { useEffect, useRef } from 'react';
2-
import FeedbackForm from '@components/FeedbackForm/FeedbackForm';
3-
import EditableFeedbackBox from '@components/EditableFeedbackBox/EditableFeedbackBox';
2+
import EditableFeedbackBox from '@components/FeedbackItem/FeedbackItem';
43
import { useRecoilValue } from 'recoil';
54
import { feedbackListSelector, isFbSyncState } from '@store/feedback.store';
65
import { focusIndexSelector } from '@store/currentVideoTime.store';
76

8-
import { feedbackAreaStyle, feedbackListStyle } from './FeedbackArea.style';
7+
import { feedbackListStyle } from './FeedbackList.style';
98

10-
const FeedbackArea = () => {
9+
const FeedbackList = () => {
1110
const feedbackRef = useRef([]);
1211
const feedbackList = useRecoilValue(feedbackListSelector);
1312
const focusIndex = useRecoilValue(focusIndexSelector);
@@ -22,20 +21,17 @@ const FeedbackArea = () => {
2221
}, [focusIndex, isFbSync]);
2322

2423
return (
25-
<div css={feedbackAreaStyle}>
26-
<div css={feedbackListStyle}>
27-
{feedbackList.map((feedback, idx) => (
28-
<EditableFeedbackBox
29-
key={feedback.id}
30-
feedback={feedback}
31-
feedbackRef={feedbackRef}
32-
index={idx}
33-
/>
34-
))}
35-
</div>
36-
<FeedbackForm />
24+
<div css={feedbackListStyle}>
25+
{feedbackList.map((feedback, idx) => (
26+
<EditableFeedbackBox
27+
key={feedback.id}
28+
feedback={feedback}
29+
feedbackRef={feedbackRef}
30+
index={idx}
31+
/>
32+
))}
3733
</div>
3834
);
3935
};
4036

41-
export default FeedbackArea;
37+
export default FeedbackList;

frontend/src/pages/Feedback/Feedback.style.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,21 @@ export const feedbackPageContainerStyle = css`
1616
max-width: 1200px;
1717
margin: auto;
1818
`;
19+
20+
export const feedbackSyncBtnStyle = (theme, isFbSync) => css`
21+
background-color: ${isFbSync ? theme.colors.primary : theme.colors.white};
22+
width: 50;
23+
height: 50;
24+
border-radius: '25px';
25+
display: 'flex';
26+
justify-content: 'center';
27+
align-items: 'center';
28+
`;
29+
30+
export const feedbackAreaStyle = css`
31+
display: flex;
32+
flex-direction: column;
33+
width: 50%;
34+
height: 80%;
35+
gap: 25px;
36+
`;

frontend/src/pages/Feedback/Feedback.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
33
import axios from 'axios';
44

55
import IntervieweeVideo from '@components/IntervieweeVideo/IntervieweeVideo';
6-
import FeedbackArea from '@components/FeedbackArea/FeedbackArea';
6+
import FeedbackList from '@components/FeedbackList/FeedbackList';
77
import BottomBar from '@components/BottomBar/BottomBar';
88
import RoundButton from '@components/@shared/RoundButton/RoundButton';
99
import usePreventLeave from '@hooks/usePreventLeave';
@@ -13,13 +13,19 @@ import { completedFbCntState, docsUUIDState, meInRoomState } from '@store/room.s
1313

1414
import { ReactComponent as LinkIcon } from '@assets/icon/link.svg';
1515
import { socket } from '../../service/socket';
16-
import { feedbackWrapperStyle, feedbackPageContainerStyle } from './Feedback.style';
16+
import {
17+
feedbackWrapperStyle,
18+
feedbackPageContainerStyle,
19+
feedbackAreaStyle,
20+
feedbackSyncBtnStyle,
21+
} from './Feedback.style';
1722
import { PAGE_TYPE } from '@constants/page.constant';
1823
import theme from '@styles/theme';
1924
import { iconBgStyle } from '@styles/commonStyle';
2025
import { socketEmit } from '@api/socket.api';
2126
import { SOCKET_EVENT_TYPE } from '@constants/socket.constant';
2227
import { FeedbackDtoType } from '@customType/DTO';
28+
import FeedbackForm from '@components/FeedbackForm/FeedbackForm';
2329

2430
const Feedback = () => {
2531
usePreventLeave();
@@ -76,23 +82,18 @@ const Feedback = () => {
7682
<div css={feedbackPageContainerStyle}>
7783
<IntervieweeVideo src={videoUrl} width={400} autoplay muted controls />
7884
<button
79-
style={{
80-
backgroundColor: isFbSync ? theme.colors.primary : theme.colors.white,
81-
width: 50,
82-
height: 50,
83-
borderRadius: '25px',
84-
display: 'flex',
85-
justifyContent: 'center',
86-
alignItems: 'center',
87-
}}
85+
css={(theme) => feedbackSyncBtnStyle(theme, isFbSync)}
8886
onClick={() => setIsFbSync((current) => !current)}
8987
>
9088
<LinkIcon
9189
{...iconBgStyle}
9290
fill={isFbSync ? theme.colors.white : theme.colors.primary}
9391
/>
9492
</button>
95-
<FeedbackArea />
93+
<div css={feedbackAreaStyle}>
94+
<FeedbackList />
95+
<FeedbackForm />
96+
</div>
9697
</div>
9798
<BottomBar mainController={finishFeedbackBtn} />
9899
</div>

frontend/src/pages/Interviewer/Interviewer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
22
import { useRecoilValue } from 'recoil';
33

44
import IntervieweeVideo from '@components/IntervieweeVideo/IntervieweeVideo';
5-
import FeedbackArea from '@components/FeedbackArea/FeedbackArea';
5+
import FeedbackList from '@components/FeedbackList/FeedbackList';
66
import Video from '@components/@shared/Video/Video';
77
import useSafeNavigate from '@hooks/useSafeNavigate';
88
import usePreventLeave from '@hooks/usePreventLeave';
@@ -57,7 +57,7 @@ const Interviewer = () => {
5757
/>
5858
))}
5959

60-
<FeedbackArea />
60+
<FeedbackList />
6161
<button onClick={hadleEndInterview}>면접 종료</button>
6262
</div>
6363
);

0 commit comments

Comments
 (0)