Skip to content

Commit 8213eae

Browse files
authored
Merge pull request #206 from DevKor-github/feat/#202/chat-pick
feat: ์ฑ„ํŒ…๋ฐฉ์— pick ๋ฒ„ํŠผ ์ถ”๊ฐ€
2 parents 9818f1d + 1927754 commit 8213eae

3 files changed

Lines changed: 82 additions & 14 deletions

File tree

โ€Žsrc/features/chatRoom/components/ChatRoomLayout/ChatRoomHeader/index.tsxโ€Ž

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,45 @@ import { useNavigate } from 'react-router';
22
import * as s from './style.css';
33
import SchoolVerifiedTag from '@/common/components/SchoolVerifiedTag';
44
import { UserProfileImage } from '@/common/components/UserProfileImage';
5-
import type { ChatRoomInterface } from '@/features/chatRoom/types';
5+
import type { ChatRoomInterface, CurrentAppointmentInterface } from '@/features/chatRoom/types';
6+
import RepickaLogo from '@/libs/assets/RepickaLogo';
67

78
export interface Props {
8-
data: ChatRoomInterface;
9+
chatRoomData: ChatRoomInterface;
10+
appointmentData: CurrentAppointmentInterface;
911
}
1012

11-
const ChatRoomHeader = ({ data }: Props) => {
13+
const ChatRoomHeader = ({ appointmentData, chatRoomData }: Props) => {
1214
const navigate = useNavigate();
1315
const goBack = () => navigate(-1);
1416

15-
const nickname = data.opponentNickname;
16-
const isOpponentKorean = data.isOpponentKorean;
17+
const nickname = chatRoomData.opponentNickname;
18+
const isOpponentKorean = chatRoomData.isOpponentKorean;
19+
const profileImg = chatRoomData.opponentProfileImageUrl;
20+
const isPicked = appointmentData.isPresent;
21+
22+
const onClick = () => {
23+
if (isPicked) navigate(`/pick-detail/${appointmentData.appointment.appointmentId}`);
24+
};
1725

1826
return (
19-
<header className={s.Container}>
20-
<button className={`mgc_left_fill ${s.BackBtn}`} onClick={goBack}></button>
21-
<div className={s.UserInfo}>
22-
<UserProfileImage nickname={data.opponentNickname} src={data.opponentProfileImageUrl} />
23-
<div className={s.Verifiy}>
24-
{isOpponentKorean && <SchoolVerifiedTag />}
25-
<span>{nickname}</span>
27+
<header className={s.Wrapper}>
28+
<div className={s.Container}>
29+
<button className={`mgc_left_fill ${s.BackBtn}`} onClick={goBack}></button>
30+
<div className={s.UserInfo}>
31+
<UserProfileImage nickname={nickname} src={profileImg} />
32+
<div className={s.Verifiy}>
33+
{isOpponentKorean && <SchoolVerifiedTag />}
34+
<span>{nickname}</span>
35+
</div>
2636
</div>
2737
</div>
38+
<button className={s.Pick({ isPicked })} onClick={onClick}>
39+
<div className={s.Logo({ isPicked })}>
40+
<RepickaLogo />
41+
</div>
42+
PICK
43+
</button>
2844
</header>
2945
);
3046
};

โ€Žsrc/features/chatRoom/components/ChatRoomLayout/ChatRoomHeader/style.css.tsโ€Ž

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { css } from '@styled-system/css';
1+
import { css, cva } from '@styled-system/css';
2+
3+
export const Wrapper = css({
4+
display: 'flex',
5+
justifyContent: 'space-between',
6+
alignItems: 'center',
7+
paddingRight: '1rem',
8+
});
29

310
export const Container = css({
411
display: 'flex',
@@ -10,6 +17,51 @@ export const Container = css({
1017
flexShrink: 0,
1118
});
1219

20+
export const Pick = cva({
21+
base: {
22+
display: 'flex',
23+
p: '0.5rem',
24+
alignItems: 'center',
25+
gap: '0.375rem',
26+
borderRadius: '6.25rem',
27+
bg: 'systemGray5',
28+
29+
fontFamily: 'Pretendard',
30+
fontSize: '0.75rem',
31+
fontStyle: 'normal',
32+
fontWeight: 400,
33+
lineHeight: 'normal',
34+
letterSpacing: '-0.03rem',
35+
},
36+
variants: {
37+
isPicked: {
38+
true: {
39+
borderWidth: '1px',
40+
borderStyle: 'solid',
41+
borderColor: 'systemGray4',
42+
color: 'main',
43+
},
44+
false: {
45+
color: '20',
46+
},
47+
},
48+
},
49+
});
50+
51+
export const Logo = cva({
52+
base: {
53+
width: '1rem',
54+
aspectRatio: '1/1',
55+
},
56+
variants: {
57+
isPicked: {
58+
false: {
59+
opacity: 0.2,
60+
},
61+
},
62+
},
63+
});
64+
1365
export const UserInfo = css({
1466
display: 'flex',
1567
gap: '0.875rem',

โ€Žsrc/pages/ChatRoomPage/index.tsxโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ChatRoomPage = () => {
2323
return (
2424
<SafeArea>
2525
<div className={s.entireLayout}>
26-
<ChatRoomHeader data={chatRoomInfo.chatRoom} />
26+
<ChatRoomHeader appointmentData={chatRoomInfo.currentAppointment} chatRoomData={chatRoomInfo.chatRoom} />
2727
<ItemInfo data={chatRoomInfo.item} />
2828
<ChatRoomContent data={chatRoomInfo.chatRoom} />
2929
<ChatRoomFooter data={chatRoomInfo.chatRoom} />

0 commit comments

Comments
ย (0)