Skip to content

Commit 705ca59

Browse files
committed
chore(reserve): 예약 params로 유동적으로 변경
1 parent 45edbaf commit 705ca59

File tree

2 files changed

+41
-28
lines changed

2 files changed

+41
-28
lines changed

src/templates/reserve/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import React from "react";
77
import dayjs from "dayjs";
88
import styled from "styled-components";
99
import { useRecoilValue } from "recoil";
10+
import { useSearchParams } from "next/navigation";
1011
import { reserveViewTypeStore } from "@/store/reserveViewType.store";
1112
import ReserveJoinBox from "./layouts/ReserveJoinBox";
1213
import ReserveCategories from "./layouts/ReserveCategories";
@@ -16,7 +17,10 @@ import ReserveList from "./layouts/ReserveList";
1617

1718
const ReservePage = () => {
1819
const reserveViewType = useRecoilValue(reserveViewTypeStore);
19-
const [date, setDate] = React.useState(dayjs().format("YYYY-MM-DD"));
20+
const searchParams = useSearchParams();
21+
const [date, setDate] = React.useState(
22+
searchParams.get("date") || dayjs().format("YYYY-MM-DD"),
23+
);
2024
const [reserve, setReserve] = React.useState<IReserveList>(emptyReserve);
2125
const { data, isSuccess, refetch } = useReserveListQuery({ date });
2226

@@ -78,9 +82,9 @@ const Title = styled.span`
7882
`;
7983

8084
const ReservationBox = styled.div`
81-
width: fit-content;
85+
width: 100%;
8286
height: fit-content;
83-
padding: 10px 20px;
87+
padding: 0px 20px;
8488
${flex.COLUMN};
8589
gap: 12px;
8690
`;

src/templates/reserve/layouts/ReserveMap.tsx

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,48 @@ const ReserveMap = ({ reservedList }: IReserveMapProps) => {
1818
};
1919

2020
return (
21-
<Column gap="8px">
22-
<Row gap="8px">
23-
<CommonRoom
24-
isReserved={reservedList.includes(1)}
25-
isClicked={room === 1}
26-
onClick={() => handleRoomButtonClick(1)}
27-
/>
28-
<CommonRoom
29-
isReserved={reservedList.includes(2)}
30-
isClicked={room === 2}
31-
onClick={() => handleRoomButtonClick(2)}
32-
/>
33-
<CommonRoom
34-
isReserved={reservedList.includes(3)}
35-
isClicked={room === 3}
36-
onClick={() => handleRoomButtonClick(3)}
37-
/>
38-
<Wall />
39-
</Row>
40-
<Row gap="8px">
21+
<Container>
22+
<Column gap="8px" width="100%">
23+
<Row gap="8px" width="100%" justifyContent="space-between">
24+
<CommonRoom
25+
isReserved={reservedList.includes(1)}
26+
isClicked={room === 1}
27+
onClick={() => handleRoomButtonClick(1)}
28+
/>
29+
<CommonRoom
30+
isReserved={reservedList.includes(2)}
31+
isClicked={room === 2}
32+
onClick={() => handleRoomButtonClick(2)}
33+
/>
34+
<CommonRoom
35+
isReserved={reservedList.includes(3)}
36+
isClicked={room === 3}
37+
onClick={() => handleRoomButtonClick(3)}
38+
/>
39+
</Row>
4140
<CommunityHall />
41+
</Column>
42+
<Column gap="8px" width="30%">
43+
<Wall />
4244
<LongRoom
4345
isReserved={reservedList.includes(4)}
4446
isClicked={room === 4}
4547
onClick={() => handleRoomButtonClick(4)}
4648
/>
47-
</Row>
48-
</Column>
49+
</Column>
50+
</Container>
4951
);
5052
};
5153

54+
const Container = styled.div`
55+
width: 100%;
56+
display: flex;
57+
height: 100%;
58+
gap: 8px;
59+
`;
60+
5261
const CommonRoom = styled.div<{ isClicked?: boolean; isReserved?: boolean }>`
53-
width: 10vw;
62+
width: 100%;
5463
height: 8vh;
5564
cursor: pointer;
5665
${({ isReserved }) =>
@@ -84,12 +93,12 @@ const CommonRoom = styled.div<{ isClicked?: boolean; isReserved?: boolean }>`
8493
`;
8594

8695
const LongRoom = styled(CommonRoom)`
87-
width: 13.3vw;
96+
width: 100%;
8897
height: 12vw;
8998
`;
9099

91100
const Wall = styled.div`
92-
width: 10vw;
101+
width: 100%;
93102
height: 8vh;
94103
background-color: ${color.light_gray};
95104
box-shadow: 4px 4px 15px 0 rgba(0, 0, 0, 0.05);

0 commit comments

Comments
 (0)