diff --git a/src/App.js b/src/App.js
index cba1912..bb77057 100644
--- a/src/App.js
+++ b/src/App.js
@@ -123,6 +123,7 @@ function App() {
} />
} />
} />
+
diff --git a/src/components/PeopleInput.js b/src/components/PeopleInput.js
new file mode 100644
index 0000000..7909f78
--- /dev/null
+++ b/src/components/PeopleInput.js
@@ -0,0 +1,18 @@
+import { CONSTANTS } from '../constants/bookingIndex';
+
+// 공통으로 사용되는 인풋 컴포넌트들
+export const PeopleInput = ({ bookingData, handleInputChange }) => (
+
+
+
+
+ );
+
\ No newline at end of file
diff --git a/src/components/RenderStepIndicator.js b/src/components/RenderStepIndicator.js
new file mode 100644
index 0000000..02519c5
--- /dev/null
+++ b/src/components/RenderStepIndicator.js
@@ -0,0 +1,24 @@
+import { CONSTANTS } from '../constants/bookingIndex.js';
+
+export const RenderStepIndicator = ({step}) => (
+
+
+ {Array.from({ length: CONSTANTS.STEPS }, (_, i) => i + 1).map((stepNum) => (
+
= stepNum ? 'bg-blue-500 text-white' : 'bg-gray-200'
+ }`}
+ >
+ {stepNum}
+
+ ))}
+
+
+
+);
diff --git a/src/components/RequirmentsInput.js b/src/components/RequirmentsInput.js
new file mode 100644
index 0000000..f95c6e3
--- /dev/null
+++ b/src/components/RequirmentsInput.js
@@ -0,0 +1,12 @@
+export const RequirementsInput = ({ bookingData, handleInputChange }) => (
+
+
+
+
+);
\ No newline at end of file
diff --git a/src/components/TimeSelection.js b/src/components/TimeSelection.js
new file mode 100644
index 0000000..aa776bc
--- /dev/null
+++ b/src/components/TimeSelection.js
@@ -0,0 +1,36 @@
+export const TimeSelect = ({ label, name, value, onChange, options }) => (
+
+
+
+
+ );
+
+
+export const TimeSelection = ({ bookingData, handleInputChange, timeOptions }) => (
+
+
+
+
+);
\ No newline at end of file
diff --git a/src/components/steps/BookingStep1.js b/src/components/steps/BookingStep1.js
new file mode 100644
index 0000000..5b43132
--- /dev/null
+++ b/src/components/steps/BookingStep1.js
@@ -0,0 +1,40 @@
+import { PeopleInput } from "../PeopleInput";
+import {TimeSelection} from "../TimeSelection";
+import {RequirementsInput} from "../RequirmentsInput";
+import {generateTimeOptions} from "../../utils/timeUtils";
+
+// Step 컴포넌트들
+export const BookingStep1 = ({ bookingData, handleInputChange }) => (
+
+ );
+
+
+ export default BookingStep1
\ No newline at end of file
diff --git a/src/components/steps/BookingStep2.js b/src/components/steps/BookingStep2.js
new file mode 100644
index 0000000..2be4267
--- /dev/null
+++ b/src/components/steps/BookingStep2.js
@@ -0,0 +1,40 @@
+import { PAYMENT_METHODS } from "../../constants/bookingIndex";
+
+// Step 2: 예약자 정보
+export const BookingStep2 = ({ bookingData, handleInputChange }) => (
+
+ );
\ No newline at end of file
diff --git a/src/components/steps/BookingStep3.js b/src/components/steps/BookingStep3.js
new file mode 100644
index 0000000..a0d1df8
--- /dev/null
+++ b/src/components/steps/BookingStep3.js
@@ -0,0 +1,40 @@
+import { PAYMENT_METHODS } from "../../constants/bookingIndex";
+
+// Step 3: 결제 정보
+export const BookingStep3 = ({ bookingData, handleInputChange, totalPrice }) => (
+
+
결제 정보
+
+
+
결제 금액
+
+ {bookingData.startTime} - {bookingData.endTime}
+
+
{totalPrice.toLocaleString()}원
+
+
+
+
+
+
+
+
+
+
+
+ );
\ No newline at end of file
diff --git a/src/components/steps/BookingStep4.js b/src/components/steps/BookingStep4.js
new file mode 100644
index 0000000..605ad58
--- /dev/null
+++ b/src/components/steps/BookingStep4.js
@@ -0,0 +1,31 @@
+import { PAYMENT_METHODS } from "../../constants/bookingIndex";
+
+// Step 4: 예약 확인
+export const BookingStep4 = ({ bookingData, bookingInfo, totalPrice }) => (
+
+
예약 확인
+
+
+
예약정보
+
공간: {bookingInfo.title}
+
날짜: {bookingData.date}
+
시간: {bookingData.startTime} ~ {bookingData.endTime}
+
인원: {bookingData.numberOfPeople}명
+ {bookingData.requirements && (
+
요청사항: {bookingData.requirements}
+ )}
+
+
+
예약자 정보
+
이름: {bookingData.name}
+
연락처: {bookingData.phone}
+
이메일: {bookingData.email}
+
+
+
결제 정보
+
결제 금액: {totalPrice.toLocaleString()}원
+
결제 수단: {PAYMENT_METHODS[bookingData.paymentMethod]}
+
+
+
+ );
\ No newline at end of file
diff --git a/src/constants/bookingIndex.js b/src/constants/bookingIndex.js
new file mode 100644
index 0000000..e7d2856
--- /dev/null
+++ b/src/constants/bookingIndex.js
@@ -0,0 +1,33 @@
+
+
+// 상수정의
+export const CONSTANTS = {
+ HOURLY_RATE: 5000,
+ MAX_PEOPLE: 10,
+ MIN_PEOPLE: 1,
+ STEPS: 4,
+ };
+
+
+// 초기 상태 정의
+export const initialBookingData = {
+ date: '',
+ startTime: '',
+ endTime: '',
+ numberOfPeople: 1,
+ requirements: '',
+ name: '',
+ phone: '',
+ email: '',
+ paymentMethod: 'card',
+ agreement: false
+ };
+
+
+// 결제수단 매핑
+export const PAYMENT_METHODS = {
+ kakao: '카카오페이머니',
+ card: '신용/체크카드',
+ transfer: '계좌이체',
+ vbank: '가상계좌'
+ };
\ No newline at end of file
diff --git a/src/constants/type/ItemType.js b/src/constants/type/ItemType.js
index c39e50f..3f63b4b 100644
--- a/src/constants/type/ItemType.js
+++ b/src/constants/type/ItemType.js
@@ -11,12 +11,12 @@ import { FaBookOpenReader } from "react-icons/fa6";
// 카테고리별 아이템 매핑
const ItemType = [
- { type: 'playing', title: "악기연주(합주실)", icon: , label:"악기연주(합주실)", isNew: true,to: "/rehearsal" },
- { type: 'party', title: '파티룸', icon: , label:"파티룸", to: "/party" },
- { type: 'dance', title: "댄스연습실", icon: , label:"댄스연습실", to: "/dance" },
- { type: 'karaoke', title: "노래방", icon: , label:"노래방", to: "/karaoke" },
- { type: 'studio', title: "스튜디오", icon: , label:"스튜디오", to: "/studio" },
- { type: 'camping', title: "캠핑장", icon: , label:"캠핑장", to: "/camping" },
+ { type: 'PLAYING', title: "악기연주(합주실)", icon: , label:"악기연주(합주실)", isNew: true,to: "/playing" },
+ { type: 'PARTY', title: '파티룸', icon: , label:"파티룸", to: "/party" },
+ { type: 'DANCE', title: "댄스연습실", icon: , label:"댄스연습실", to: "/dance" },
+ { type: 'KARAOKE', title: "노래방", icon: , label:"노래방", to: "/karaoke" },
+ { type: 'STUDIO', title: "스튜디오", icon: , label:"스튜디오", to: "/studio" },
+ { type: 'CAMPING', title: "캠핑장", icon: , label:"캠핑장", to: "/camping" },
{ type: 'gym', title: "헬스장", icon: , label:"헬스장", to: "/gym" },
{ type: 'office', title: "사무실", icon: , label:"사무실",to: "/office" },
{ type: 'accommodation', title: "숙박", icon: , label:"숙박",to: "/accommodation" },
diff --git a/src/pages/booking.js b/src/pages/booking.js
index 1fa87f5..d020c53 100644
--- a/src/pages/booking.js
+++ b/src/pages/booking.js
@@ -1,249 +1,15 @@
import { useState } from "react";
import { useLocation } from 'react-router-dom';
import "../styles/booking.css"
+import {calculatePrice} from '../utils/timeUtils';
+import { CONSTANTS, initialBookingData } from '../constants/bookingIndex';
+import { RenderStepIndicator } from '../components/RenderStepIndicator';
+import { BookingStep1 } from '../components/steps/BookingStep1';
+import { BookingStep2 } from '../components/steps/BookingStep2';
+import { BookingStep3 } from '../components/steps/BookingStep3';
+import { BookingStep4 } from '../components/steps/BookingStep4';
-// 상수 정의
-const CONSTANTS = {
- HOURLY_RATE: 5000,
- MAX_PEOPLE: 10,
- MIN_PEOPLE: 1,
- STEPS: 4,
-};
-// 초기 상태 정의
-const initialBookingData = {
- date: '',
- startTime: '',
- endTime: '',
- numberOfPeople: 1,
- requirements: '',
- name: '',
- phone: '',
- email: '',
- paymentMethod: 'card',
- agreement: false
-};
-
-// 결제 수단 매핑
-const PAYMENT_METHODS = {
- kakao: '카카오페이머니',
- card: '신용/체크카드',
- transfer: '계좌이체',
- vbank: '가상계좌'
-};
-
-// 시간 옵션 생성 유틸리티 함수
-const generateTimeOptions = () =>
- Array.from({ length: 24 }, (_, i) => ({
- value: `${i.toString().padStart(2, '0')}:00`,
- label: `${i.toString().padStart(2, '0')}:00`
- }));
-
-// 공통으로 사용되는 인풋 컴포넌트들
-const PeopleInput = ({ bookingData, handleInputChange }) => (
-
-
-
-
-);
-
-const RequirementsInput = ({ bookingData, handleInputChange }) => (
-
-
-
-
-);
-
-const TimeSelection = ({ bookingData, handleInputChange, timeOptions }) => (
-
-
-
-
-);
-
-const TimeSelect = ({ label, name, value, onChange, options }) => (
-
-
-
-
-);
-
-// Step 컴포넌트들
-const BookingStep1 = ({ bookingData, handleInputChange }) => (
-
-);
-
- // Step 2: 예약자 정보
- const BookingStep2 = ({ bookingData, handleInputChange }) => (
-
- );
-
- // Step 3: 결제 정보
- const BookingStep3 = ({ bookingData, handleInputChange, totalPrice }) => (
-
-
결제 정보
-
-
-
결제 금액
-
- {bookingData.startTime} - {bookingData.endTime}
-
-
{totalPrice.toLocaleString()}원
-
-
-
-
-
-
-
-
-
-
-
- );
-
- // Step 4: 예약 확인
- const BookingStep4 = ({ bookingData, bookingInfo, totalPrice }) => (
-
-
예약 확인
-
-
-
예약정보
-
공간: {bookingInfo.title}
-
날짜: {bookingData.date}
-
시간: {bookingData.startTime} ~ {bookingData.endTime}
-
인원: {bookingData.numberOfPeople}명
- {bookingData.requirements && (
-
요청사항: {bookingData.requirements}
- )}
-
-
-
예약자 정보
-
이름: {bookingData.name}
-
연락처: {bookingData.phone}
-
이메일: {bookingData.email}
-
-
-
결제 정보
-
결제 금액: {totalPrice.toLocaleString()}원
-
결제 수단: {PAYMENT_METHODS[bookingData.paymentMethod]}
-
-
-
- );
// BookingForm 메인 컴포넌트
export default function BookingForm() {
@@ -254,12 +20,7 @@ export default function BookingForm() {
const [bookingData, setBookingData] = useState(initialBookingData);
const [totalPrice, setTotalPrice] = useState(0);
- const calculatePrice = (start, end) => {
- if (!start || !end) return 0;
- const [startHour, endHour] = [start, end].map(time =>
- parseInt(time.split(':')[0]));
- return Math.max(0, endHour - startHour) * CONSTANTS.HOURLY_RATE;
- };
+
const handleInputChange = (e) => {
const { name, value, type, checked } = e.target;
@@ -289,34 +50,12 @@ export default function BookingForm() {
}
};
- const renderStepIndicator = () => (
-
-
- {Array.from({ length: CONSTANTS.STEPS }, (_, i) => i + 1).map((stepNum) => (
-
= stepNum ? 'bg-blue-500 text-white' : 'bg-gray-200'
- }`}
- >
- {stepNum}
-
- ))}
-
-
-
- );
return (
<>
- {renderStepIndicator()}
+