Skip to content

Commit 7efd26a

Browse files
committed
feat: 매칭 수락/거절 버튼 UI 구현
1 parent 7454240 commit 7efd26a

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

src/pages/Chats/MatchingRoom/MatchingMessage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const MatchingMessage: React.FC<MatchingData> = ({ id, message, createdAt, chatR
1616
fromUserNickname: '오딩이',
1717
profilePictureUrl: '',
1818
content: '얘가 너 소개받고 싶대',
19-
isSenderChanged: true,
19+
isSenderChanged: false,
2020
isProfileImageVisible: true,
2121
isTimeVisible: false,
2222
formattedTime,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { ResponseButton, ResponseContainer } from './styles';
2+
3+
export interface ResponseMessageProps {
4+
requestStatus: 'accepted' | 'rejected' | 'pending';
5+
}
6+
7+
const ResponseMessage: React.FC<ResponseMessageProps> = ({ requestStatus }) => {
8+
return (
9+
<ResponseContainer>
10+
{(requestStatus === 'pending' || 'accepted') && <ResponseButton>거절</ResponseButton>}
11+
{(requestStatus === 'pending' || 'rejected') && <ResponseButton>수락</ResponseButton>}
12+
</ResponseContainer>
13+
);
14+
};
15+
16+
export default ResponseMessage;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { styled } from 'styled-components';
2+
3+
export const ResponseContainer = styled.div`
4+
display: flex;
5+
gap: 0.5rem;
6+
justify-content: flex-end;
7+
`;
8+
9+
export const ResponseButton = styled.button`
10+
padding: 0.4rem 0.8rem;
11+
margin: 0.5rem 0;
12+
background-color: #f2f2f2;
13+
border-radius: 0.5rem;
14+
overflow-wrap: break-word;
15+
`;

src/pages/Chats/MatchingRoom/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import Back from '@assets/arrow/left.svg';
1010
import { OODDFrame } from '@components/Frame/Frame';
1111
import TopBar from '@components/TopBar';
1212

13+
import ChatBox from '../ChatBox';
14+
1315
import MatchingMessage from './MatchingMessage';
1416
import NoMatchingMessage from './NoMatchingMessage';
17+
import ResponseMessage from './ResponseMessage';
1518
import { MessagesContainer } from './styles';
1619

1720
const MatchingRoom: React.FC = () => {
@@ -92,11 +95,17 @@ const MatchingRoom: React.FC = () => {
9295
) : (
9396
allMatchings.map((matching: MatchingData) => {
9497
// TODO: 매칭 상태에 따라 응답 버튼 렌더링
95-
return <MatchingMessage key={matching.id} {...matching} />;
98+
return (
99+
<div key={matching.id}>
100+
<MatchingMessage {...matching} />
101+
<ResponseMessage requestStatus={matching.requestStatus} />
102+
</div>
103+
);
96104
})
97105
)}
98106
<div ref={chatWindowRef} />
99107
</MessagesContainer>
108+
<ChatBox />
100109
</OODDFrame>
101110
);
102111
};

0 commit comments

Comments
 (0)