Skip to content

Commit 67882b9

Browse files
authored
Merge pull request #89 from DevKor-github/feat/#63/detail-bottom
[#63] μ œν’ˆ νŽ˜μ΄μ§€ ν•˜λ‹¨ λ°” κ΅¬ν˜„ κ΅¬ν˜„
2 parents 4c95d9c + 81b259f commit 67882b9

5 files changed

Lines changed: 154 additions & 3 deletions

File tree

β€Žpanda.config.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineConfig } from '@pandacss/dev';
33
const PANDA_CSS_CONSTANTS = {
44
NAVIGATOR_HEIGHT: { value: '97px' },
55
HOME_HEADER_HEIGHT: { value: '52px' },
6-
DETAIL_PAGE_NAVIGATOR_HEIGHT: { value: '6.75rem' },
6+
DETAIL_PAGE_NAVIGATOR_HEIGHT: { value: '6.375rem' },
77
MAX_WIDTH: { value: '700px' },
88
CHAT_ROOM_FOOTER_HEIGHT: { value: '102px' },
99
CHAT_MAX_WIDTH: { value: '270px' },

β€Žsrc/common/components/Button/index.tsxβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import type { HTMLAttributes, PropsWithChildren } from 'react';
2+
import { cx } from '@styled-system/css';
3+
24
import * as s from './style.css';
35

46
interface Props extends PropsWithChildren {
57
mode?: 'main' | 'default' | 'back' | 'disabled';
68
onClick?: () => void;
79
style?: HTMLAttributes<HTMLDivElement>['style'];
10+
className?: string;
811
}
9-
const Btn = ({ children, mode = 'default', onClick, style }: Props) => {
12+
const Btn = ({ children, mode = 'default', onClick, style, className }: Props) => {
1013
return (
11-
<div className={s.Button({ mode })} style={style} onClick={onClick}>
14+
<div className={cx(s.Button({ mode }), className)} style={style} onClick={onClick}>
1215
{children}
1316
</div>
1417
);
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import Btn from '@/common/components/Button';
2+
3+
import * as s from './style.css';
4+
import type { TransactionType } from '@/libs/types/item';
5+
import type { ItemInfoInterface } from '@/features/detail/types';
6+
7+
interface PickButtonProps {
8+
type: TransactionType;
9+
index: number;
10+
salePrice: number;
11+
deposit: number;
12+
rentalFee: number;
13+
}
14+
const PickButton = ({ type, index, salePrice, deposit, rentalFee }: PickButtonProps) => {
15+
const color = index === 0 ? 'red' : 'blue';
16+
const label = type === 'RENTAL' ? 'λŒ€μ—¬' : 'ꡬ맀';
17+
const priceText =
18+
type === 'RENTAL'
19+
? `λŒ€μ—¬λ£Œ+보증금 ${(deposit + rentalFee).toLocaleString()}원`
20+
: `νŒλ§€κ°€ ${salePrice.toLocaleString()}원`;
21+
22+
const handlePickClick = () => {
23+
alert(`${type} 선택`);
24+
};
25+
26+
return (
27+
<button className={s.PickButton({ color })} onClick={handlePickClick} aria-label={`${label}, ${priceText}`}>
28+
<span>{label}</span>
29+
<p>{priceText}</p>
30+
</button>
31+
);
32+
};
33+
34+
interface Props {
35+
itemInfo: ItemInfoInterface;
36+
}
37+
const BottomActions = ({ itemInfo }: Props) => {
38+
const { transactionTypes, mine, salePrice, deposit, rentalFee } = itemInfo;
39+
40+
// TODO: μ‹€μ œ μ•‘μ…˜ μΆ”κ°€
41+
const handleChatClick = () => {
42+
alert('μ±„νŒ… μ—°κ²°');
43+
};
44+
45+
return (
46+
<div className={s.Container}>
47+
<Btn className={s.ChatButton({ isMine: mine })} onClick={handleChatClick}>
48+
<span className="mgc_chat_2_fill" />
49+
{mine && <p>μ±„νŒ…</p>}
50+
</Btn>
51+
{!mine && (
52+
<div className={s.PickButtonContainer}>
53+
{transactionTypes.map((type, index) => {
54+
return (
55+
<PickButton
56+
key={type}
57+
type={type}
58+
index={index}
59+
salePrice={salePrice}
60+
deposit={deposit}
61+
rentalFee={rentalFee}
62+
/>
63+
);
64+
})}
65+
</div>
66+
)}
67+
</div>
68+
);
69+
};
70+
export default BottomActions;
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import { css, cva } from '@styled-system/css';
2+
3+
export const Container = css({
4+
position: 'fixed',
5+
bottom: '0',
6+
left: '0',
7+
right: '0',
8+
height: 'DETAIL_PAGE_NAVIGATOR_HEIGHT',
9+
display: 'flex',
10+
gap: '0.87rem',
11+
px: '1rem',
12+
pt: '0.625rem',
13+
bg: 'linear-gradient(180deg, rgba(28, 28, 30, 0.00) 0%, #1C1C1E 8.82%)',
14+
roundedTop: '0.625rem',
15+
});
16+
17+
export const ChatButton = cva({
18+
base: {
19+
flexShrink: 0,
20+
height: '3.125rem',
21+
},
22+
variants: {
23+
isMine: {
24+
true: {
25+
width: 'full',
26+
},
27+
false: {
28+
width: '3.125rem',
29+
},
30+
},
31+
},
32+
});
33+
34+
export const PickButtonContainer = css({
35+
flexGrow: 1,
36+
display: 'flex',
37+
alignItems: 'center',
38+
gap: '0.87rem',
39+
height: '3.125rem',
40+
});
41+
42+
export const PickButton = cva({
43+
base: {
44+
flexGrow: 1,
45+
flexBasis: 0,
46+
flexDir: 'column',
47+
gap: '0.25rem',
48+
height: 'full',
49+
overflow: 'hidden',
50+
rounded: '0.375rem',
51+
'& > span': {
52+
color: '80',
53+
fontSize: '1rem',
54+
fontWeight: 500,
55+
lineHeight: 'normal',
56+
letterSpacing: '-0.04rem',
57+
},
58+
'& > p': {
59+
color: '100',
60+
fontSize: '0.75rem',
61+
fontWeight: 600,
62+
lineHeight: 'normal',
63+
letterSpacing: '-0.03rem',
64+
},
65+
},
66+
variants: {
67+
color: {
68+
red: {
69+
bgColor: 'main',
70+
},
71+
blue: {
72+
bgColor: '#3978FF',
73+
},
74+
},
75+
},
76+
});

β€Žsrc/pages/DetailPage/index.tsxβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ImageContainer from '@/features/detail/components/ImageContainer';
77
import UserInfo from '@/features/detail/components/UserInfo';
88
import PostContent from '@/features/detail/components/PostContent';
99
import useGetItemDetail from '@/features/detail/apis/useGetItemDetail';
10+
import BottomActions from '@/features/detail/components/BottomActions';
1011

1112
const DetailPage = () => {
1213
const { id } = useParams();
@@ -26,6 +27,7 @@ const DetailPage = () => {
2627
<PostContent itemInfo={data.itemInfo} />
2728
</div>
2829
</div>
30+
<BottomActions itemInfo={data.itemInfo} />
2931
</div>
3032
);
3133
};

0 commit comments

Comments
Β (0)