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));