Skip to content

Commit 5c35b95

Browse files
authored
Merge pull request #72 from DevKor-github/feat/#43/step5
2 parents ea403ad + a863853 commit 5c35b95

56 files changed

Lines changed: 1178 additions & 426 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default tseslint.config(
2020
react,
2121
'react-hooks': reactHooks,
2222
'react-refresh': reactRefresh,
23+
'@tanstack/query': tanstackPlugin,
2324
prettier,
2425
},
2526
rules: {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"react": "^19.1.0",
2222
"react-dom": "^19.1.0",
2323
"react-router": "^7.6.3",
24-
"swiper": "^11.2.10"
24+
"swiper": "^11.2.10",
25+
"zustand": "^5.0.6"
2526
},
2627
"devDependencies": {
2728
"@eslint/js": "^9.25.0",

src/assets/images/rental.png

-1.84 KB
Loading

src/common/components/Button/style.css.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ export const Button = cva({
66
gap: '0.625rem',
77
flexShrink: '0',
88
justifyContent: 'center',
9+
alignItems: 'center',
910
padding: '0.625rem',
1011
borderRadius: '0.375rem',
11-
width: '100%',
12+
// width: '100%',
1213
height: '3.125rem',
1314
fontFamily: 'Pretendard',
1415
fontSize: '1.25rem',
1516
fontStyle: 'normal',
1617
fontWeight: '500',
1718
lineHeight: 'normal',
1819
letterSpacing: '-0.05rem',
20+
transition: 'background 0.3s ease-in-out',
21+
cursor: 'pointer',
1922
},
2023
variants: {
24+
// TODO: 언제 쓰이는 건지 이름 바꾸기
2125
color: {
2226
main: {
2327
backgroundColor: 'main',

src/common/components/Token/style.css.ts

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

33
export const Container = css({
4+
width: 'fit-content',
45
padding: '0.1875rem 0.3125rem',
56
borderRadius: '4px',
67
bgColor: 'main-26',

src/features/detail/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import type { ColorType, TransactionType, ProductType, QualityType, SizeType, TradeType } from '@/libs/types/item';
1+
import type { Color, TransactionType, ProductType, Quality, Size, TradeMethods } from '@/libs/types/item';
22
import type { UserInterface } from '@/libs/types/user';
33

44
export interface ItemInfoInterface {
55
productTypes: ProductType[];
66
transactionTypes: TransactionType[];
77
title: string;
88
description: string;
9-
color: ColorType;
10-
size: SizeType;
11-
quality: QualityType;
9+
color: Color;
10+
size: Size;
11+
quality: Quality;
1212
rentalFee: number;
1313
salePrice: number;
1414
deposit: number;
1515
location: string;
16-
tradeMethods: TradeType[];
16+
tradeMethods: TradeMethods[];
1717
canDeal: boolean;
1818
likeCount: number;
1919
chatRoomCount: number;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// 클라이언트 -> 백엔드로 presigned url 요청
2+
// 캐싱 필요없고 파일을 순회, 반복문 내에서 호출해야 돼서 리액트 쿼리 훅 안 써도 될 것 같은데 선생님 의견이 궁금합니다
3+
4+
import client from '@/common/utils/client';
5+
6+
export const getPresignedUrl = async (file: File) => {
7+
try {
8+
const res = await client.get('/api/v1/item/presigned-url', {
9+
params: {
10+
fileName: file.name,
11+
contentType: file.type,
12+
fileSize: file.size,
13+
},
14+
});
15+
16+
return res.data.data;
17+
} catch (error) {
18+
console.error(`presigned URL 요청 실패 (${file.name}):`, error);
19+
throw error;
20+
}
21+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// baseUrl 무시 (외부 주소)
2+
3+
import axios from 'axios';
4+
5+
export const s3PutImageToUrl = async (file: File, url: string) => {
6+
try {
7+
const res = await axios.put(url, file, {
8+
headers: { 'Content-Type': file.type },
9+
});
10+
11+
if (![200, 201].includes(res.status)) {
12+
throw new Error(`S3 responded ${res.status}`);
13+
}
14+
} catch (err) {
15+
const msg =
16+
axios.isAxiosError(err) && err.response
17+
? `S3 upload failed (${err.response.status})`
18+
: 'Network error during S3 upload';
19+
throw new Error(msg);
20+
}
21+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Btn from '@/common/components/Button';
2+
import * as s from './style.css';
3+
import { resetAllStores } from '../../stores/StoreReset';
4+
import { useNavigate } from 'react-router';
5+
6+
interface Props {
7+
onUnshow: () => void;
8+
}
9+
10+
const CustomAlert = ({ onUnshow }: Props) => {
11+
const navigator = useNavigate();
12+
13+
const onReset = () => {
14+
resetAllStores();
15+
navigator(-1);
16+
};
17+
18+
return (
19+
<div className={s.Filter}>
20+
<div className={s.Container}>
21+
<div className={s.Text}>
22+
<span>지금 그만두면 진행상황이 저장되지 않아요!</span>
23+
<p>정말 글 작성을 그만두실 건가요?</p>
24+
</div>
25+
<div className={s.Btn}>
26+
<Btn onClick={onUnshow} style={{ flex: '1' }}>
27+
아니오
28+
</Btn>
29+
<Btn color="main" onClick={onReset} style={{ width: '13.125rem' }}>
30+
네, 다음에 다시 쓸게요
31+
</Btn>
32+
</div>
33+
</div>
34+
</div>
35+
);
36+
};
37+
38+
export default CustomAlert;
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { css } from '@styled-system/css';
2+
3+
export const Filter = css({
4+
position: 'fixed',
5+
top: 0,
6+
left: 0,
7+
right: 0,
8+
bottom: 0,
9+
backgroundColor: 'rgba(0,0,0,0.60)',
10+
display: 'flex',
11+
justifyContent: 'center',
12+
alignItems: 'center',
13+
zIndex: 1000,
14+
backdropFilter: 'blur(2px)',
15+
});
16+
17+
export const Container = css({
18+
display: 'flex',
19+
flexDirection: 'column',
20+
width: '21.875rem',
21+
padding: '3.125rem 1.5rem 1.25rem 1.5rem',
22+
alignItems: 'center',
23+
gap: '3.125rem',
24+
borderRadius: '0.625rem',
25+
border: '1px solid',
26+
borderColor: 'systemGray5',
27+
backgroundColor: 'systemGray6',
28+
});
29+
30+
export const Text = css({
31+
display: 'flex',
32+
flexDirection: 'column',
33+
textAlign: 'center',
34+
fontFamily: 'Pretendard',
35+
'& span': {
36+
fontSize: '1rem',
37+
fontWeight: 600,
38+
color: '100',
39+
},
40+
'& p': {
41+
fontSize: '0.875rem',
42+
fontWeight: 400,
43+
color: '80',
44+
},
45+
fontStyle: 'normal',
46+
lineHeight: 'normal',
47+
gap: '1.25rem',
48+
});
49+
50+
export const Btn = css({
51+
display: 'flex',
52+
flex: '1',
53+
justifyContent: 'flex-end',
54+
w: '100%',
55+
gap: '0.62rem',
56+
});

0 commit comments

Comments
 (0)