+
-
-
인원
-
게스트 {totalGuest}명
+
+
인원
+
게스트 {totalGuest}명
+
);
@@ -43,11 +47,31 @@ const ReserveFormInfo = (props: Props) => {
export default ReserveFormInfo;
const StyledReserveFormInfo = styled.div`
- .reserve-form__date,
+ border-radius: 10px;
.reserve-form__column {
- padding: 1rem;
+ display: flex;
+ align-items: center;
}
+ .reserve-form__item {
+ padding: 8px;
+ .reserve-form__title {
+ font-size: ${({ theme }) => theme.fontSize.small};
+ font-weight: 700;
+ }
+ .reserve-form__info {
+ color: ${({ theme }) => theme.colors.gray2};
+ }
+ }
+ border: ${({ theme }) => `1px solid ${theme.colors.gray4}`};
.reserve-form__column:first-child {
- display: flex;
+ }
+ .reserve-form__date {
+ flex: 1;
+ }
+ .reserve-form__date:first-child {
+ border-right: ${({ theme }) => `1px solid ${theme.colors.gray4}`};
+ }
+ .reserve-form__column:last-child {
+ border-top: ${({ theme }) => `1px solid ${theme.colors.gray4}`};
}
`;
diff --git a/FE/airbnb/src/components/reserveRoomList/reserveForm/ReserveFromPrice.tsx b/FE/airbnb/src/components/reserveRoomList/reserveForm/ReserveFromPrice.tsx
new file mode 100644
index 000000000..1b354f7e5
--- /dev/null
+++ b/FE/airbnb/src/components/reserveRoomList/reserveForm/ReserveFromPrice.tsx
@@ -0,0 +1,87 @@
+import { useRecoilValue } from 'recoil';
+import styled from 'styled-components';
+import { selectDateState } from '../../../recoil/calendarAtom';
+import { getBetweenDays } from '../../header/form/calendar/calendarDateFn';
+
+interface Props {
+ chargePerNight: number;
+}
+
+const ReserveFromPrice = ({ chargePerNight }: Props) => {
+ const selectDate = useRecoilValue(selectDateState);
+
+ const getCleanCharge = (totalPrice: number): number => Math.floor(totalPrice * 0.03);
+ const getServiceCharge = (totalPrice: number): number => Math.floor(totalPrice * 0.15);
+ const getTaxCharge = (totalPrice: number): number => Math.floor(totalPrice * 0.01);
+
+ const betweenDays = getBetweenDays(selectDate.checkIn, selectDate.checkOut);
+ const totalPrice = chargePerNight * betweenDays;
+
+ const cleanCharge = getCleanCharge(totalPrice);
+ const serviceCharge = getServiceCharge(totalPrice);
+ const taxCharge = getTaxCharge(totalPrice);
+
+ const totalCharge = totalPrice + cleanCharge + serviceCharge + taxCharge;
+
+ return (
+
+
+
+
+ ₩{chargePerNight.toLocaleString()} x {betweenDays}박
+
+
₩{totalPrice.toLocaleString()}
+
+
+
청소비
+
₩{cleanCharge.toLocaleString()}
+
+
+
서비스 수수료
+
₩{serviceCharge.toLocaleString()}
+
+
+
숙박세와 수수료
+
₩{taxCharge.toLocaleString()}
+
+
+
+
+
총 합계
+
₩{totalCharge.toLocaleString()}
+
+
+
+ );
+};
+
+export default ReserveFromPrice;
+
+const StyledReservePriceWrapper = styled.div`
+ .reserve-price__column {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 8px;
+ }
+ .reserve-price__title {
+ text-decoration: underline;
+ }
+`;
+
+const StyledReserveFormPrice = styled.div`
+ padding-bottom: 1rem;
+ border-bottom: ${({ theme }) => `2px solid ${theme.colors.gray5}`};
+ margin-bottom: 1rem;
+`;
+
+const StyledReserveCharge = styled.div`
+ font-weight: 700;
+ .reserve-price__column {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 8px;
+ }
+ .reserve-price__title {
+ text-decoration: underline;
+ }
+`;
From fcd45796b6c85eafea54b9f37fcaca51454a0b21 Mon Sep 17 00:00:00 2001
From: hayoung123 <67357426+hayoung123@users.noreply.github.com>
Date: Thu, 3 Jun 2021 00:48:49 +0900
Subject: [PATCH 4/5] =?UTF-8?q?[#42]=20map=20=EC=8A=A4=EC=BC=88=EB=A0=88?=
=?UTF-8?q?=ED=86=A4=20UI=20css=20=EC=8B=9C=EB=8F=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FE/airbnb/src/App.tsx | 4 +-
.../src/components/header/form/FormGuest.tsx | 2 -
.../reservePageSkeleton/MapSkeleton.tsx | 38 +++++++++++++++++++
.../reservePageSkeleton/ReserveSkeleton.tsx | 25 ++++++++++++
.../reserveRoomList/ReserveRoomList.tsx | 1 +
.../src/components/util/ConditionalLink.tsx | 2 +-
FE/airbnb/src/pages/ReservePage.tsx | 13 ++++---
FE/airbnb/src/recoil/reserveRoomAtom.ts | 4 +-
FE/airbnb/src/util/util.js | 3 ++
9 files changed, 80 insertions(+), 12 deletions(-)
create mode 100644 FE/airbnb/src/components/reservePageSkeleton/MapSkeleton.tsx
create mode 100644 FE/airbnb/src/components/reservePageSkeleton/ReserveSkeleton.tsx
diff --git a/FE/airbnb/src/App.tsx b/FE/airbnb/src/App.tsx
index 048beee13..8c153c63b 100644
--- a/FE/airbnb/src/App.tsx
+++ b/FE/airbnb/src/App.tsx
@@ -21,9 +21,7 @@ function App() {
-
-
-
+
diff --git a/FE/airbnb/src/components/header/form/FormGuest.tsx b/FE/airbnb/src/components/header/form/FormGuest.tsx
index 9383b3307..5100c60d4 100644
--- a/FE/airbnb/src/components/header/form/FormGuest.tsx
+++ b/FE/airbnb/src/components/header/form/FormGuest.tsx
@@ -8,7 +8,6 @@ import FormGuestToggle from './guestToggle/FormGuestToggle';
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil';
import { guestState, isFormOpenedState, reserveInfoSelector } from '../../../recoil/headerAtom';
import { ReactComponent as DeleteBtn } from '../../../assets/svg/Property 1=x-circle.svg';
-import { Link } from 'react-router-dom';
import ConditionalLink from '../../util/ConditionalLink';
import { reserveInfoType, clientReserveAPI } from '../../../util/api';
@@ -45,7 +44,6 @@ const FormGuest = () => {
};
const handleSubmitClick = (e: MouseEvent): void => {
- console.log(reserveInfo);
e.stopPropagation();
};
diff --git a/FE/airbnb/src/components/reservePageSkeleton/MapSkeleton.tsx b/FE/airbnb/src/components/reservePageSkeleton/MapSkeleton.tsx
new file mode 100644
index 000000000..36eac57b7
--- /dev/null
+++ b/FE/airbnb/src/components/reservePageSkeleton/MapSkeleton.tsx
@@ -0,0 +1,38 @@
+import styled from 'styled-components';
+
+interface Props {}
+
+const MapSkeleton = (props: Props) => {
+ return
loading;
+};
+
+export default MapSkeleton;
+
+const StyledMapSkeleton = styled.div`
+ background-color: #f2f2f2;
+ position: absolute;
+ right: 0;
+ width: 50%;
+ height: 100%;
+
+ &::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(to right, #f2f2f2, #ddd, #f2f2f2);
+ animation: loading 1s infinite linear;
+ }
+
+ @keyframes loading {
+ 0% {
+ transform: translateX(0);
+ }
+ 50%,
+ 100% {
+ transform: translateX(460px);
+ }
+ }
+`;
diff --git a/FE/airbnb/src/components/reservePageSkeleton/ReserveSkeleton.tsx b/FE/airbnb/src/components/reservePageSkeleton/ReserveSkeleton.tsx
new file mode 100644
index 000000000..33e1ed333
--- /dev/null
+++ b/FE/airbnb/src/components/reservePageSkeleton/ReserveSkeleton.tsx
@@ -0,0 +1,25 @@
+import styled from 'styled-components';
+
+interface Props {}
+
+const ReserveSkeleton = (props: Props) => {
+ return (
+
+
+
+
+ );
+};
+
+export default ReserveSkeleton;
+
+const StyledReserveSkeleton = styled.div`
+ .skeleton__img,
+ .skeleton__info,
+ .skeleton__price {
+ background-color: f2f2f2;
+ }
+`;
diff --git a/FE/airbnb/src/components/reserveRoomList/ReserveRoomList.tsx b/FE/airbnb/src/components/reserveRoomList/ReserveRoomList.tsx
index bcef97be3..9c66cb14b 100644
--- a/FE/airbnb/src/components/reserveRoomList/ReserveRoomList.tsx
+++ b/FE/airbnb/src/components/reserveRoomList/ReserveRoomList.tsx
@@ -14,6 +14,7 @@ const ReserveRoomList = ({ className }: Props) => {
const reserveRoomList =
roomsData &&
roomsData.map((roomData, idx) =>
);
+ // const reserveRoomList = roomsData && roomsData.map((roomData, idx) =>
);
return (
diff --git a/FE/airbnb/src/components/util/ConditionalLink.tsx b/FE/airbnb/src/components/util/ConditionalLink.tsx
index 080b1cd3e..70cf17561 100644
--- a/FE/airbnb/src/components/util/ConditionalLink.tsx
+++ b/FE/airbnb/src/components/util/ConditionalLink.tsx
@@ -7,6 +7,6 @@ interface Props {
}
const ConditionalLink = ({ children, to, condition }: Props) =>
- !!condition && to ?
{children} : <>{children}>;
+ condition && to ?
{children} : <>{children}>;
export default ConditionalLink;
diff --git a/FE/airbnb/src/pages/ReservePage.tsx b/FE/airbnb/src/pages/ReservePage.tsx
index 3cf4593f7..178ea7f0a 100644
--- a/FE/airbnb/src/pages/ReservePage.tsx
+++ b/FE/airbnb/src/pages/ReservePage.tsx
@@ -1,8 +1,9 @@
-import { useEffect } from 'react';
+import { Suspense, useEffect } from 'react';
import { useRecoilValue, useRecoilState } from 'recoil';
import styled from 'styled-components';
import Map from '../components/map/Map';
import ReserveHeader from '../components/reserveHeader/ReserveHeader';
+import MapSkeleton from '../components/reservePageSkeleton/MapSkeleton';
import ReserveRoomList from '../components/reserveRoomList/ReserveRoomList';
import { reserveInfoSelector } from '../recoil/headerAtom';
import { getRoomsSelector } from '../recoil/reserveRoomAtom';
@@ -11,8 +12,6 @@ interface Props {}
const ReservePage = ({}: Props) => {
const [reserveInfo, setReserveInfo] = useRecoilState(reserveInfoSelector);
- const roomsData = useRecoilValue(getRoomsSelector);
- console.log(roomsData);
useEffect(() => {
const [encodedAddress, checkIn, checkOut, minCharge, maxCharge, adult, child, infants] =
getQueryValue(window.location.search);
@@ -35,8 +34,12 @@ const ReservePage = ({}: Props) => {
return (
-
-
+
+
+
+ }>
+
+
);
};
diff --git a/FE/airbnb/src/recoil/reserveRoomAtom.ts b/FE/airbnb/src/recoil/reserveRoomAtom.ts
index 3e47249d5..4a4c144e6 100644
--- a/FE/airbnb/src/recoil/reserveRoomAtom.ts
+++ b/FE/airbnb/src/recoil/reserveRoomAtom.ts
@@ -1,6 +1,7 @@
import { atom, selector } from 'recoil';
import { roomType } from '../components/reserveRoomList/roomType';
import { serverAPI } from '../util/api';
+import { delay } from '../util/util';
import { reserveInfoSelector, reserveQueryType } from './headerAtom';
import { roomData } from './roomSampleData';
@@ -20,7 +21,8 @@ export const getRoomsSelector = selector({
if (isUndefined(reserveInfo)) return null;
const response = await fetch(serverAPI.getRooms(reserveInfo));
const data = await response.json();
- return data;
+
+ return delay(1000, data);
},
});
diff --git a/FE/airbnb/src/util/util.js b/FE/airbnb/src/util/util.js
index d1c77545e..58cbf9575 100644
--- a/FE/airbnb/src/util/util.js
+++ b/FE/airbnb/src/util/util.js
@@ -14,3 +14,6 @@ export const getUrlParams = () => {
return params;
};
+
+export const delay = (time, value = '') =>
+ new Promise((resolve) => setTimeout(() => resolve(value), time));
From b8d0dd49a507b8559cd7c20d98149641c771be1f Mon Sep 17 00:00:00 2001
From: hayoung123 <67357426+hayoung123@users.noreply.github.com>
Date: Thu, 3 Jun 2021 01:46:05 +0900
Subject: [PATCH 5/5] =?UTF-8?q?[#42]=20mordal=20=ED=8F=AC=ED=83=88=20?=
=?UTF-8?q?=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FE/airbnb/public/index.html | 1 +
.../reserveRoomList/ReserveRoom.tsx | 15 +++----
.../reserveForm/ReserveForm.tsx | 45 ++++++++++++-------
3 files changed, 37 insertions(+), 24 deletions(-)
diff --git a/FE/airbnb/public/index.html b/FE/airbnb/public/index.html
index d16d1a6f2..0f2f85fde 100644
--- a/FE/airbnb/public/index.html
+++ b/FE/airbnb/public/index.html
@@ -13,5 +13,6 @@
+