Skip to content

Commit

Permalink
Merge pull request #375 from SCBJ-7/revert-374-feature/#349-feat-main
Browse files Browse the repository at this point in the history
Revert "Feature/#349 feat main"
  • Loading branch information
chaeminseok authored Jul 9, 2024
2 parents b837f1a + 795b65f commit 17240c4
Show file tree
Hide file tree
Showing 71 changed files with 116 additions and 1,442 deletions.
2 changes: 1 addition & 1 deletion public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */

/**
* Mock Service Worker (2.1.4).
* Mock Service Worker (2.1.5).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
Expand Down
2 changes: 1 addition & 1 deletion src/apis/fetchMainItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export const fetchMainItem = async (): Promise<

const { weekend, ...locale } = data.data;
const temp = weekend.content.length ? weekend.content : [];
console.log(data);

return [locale, temp];
};
4 changes: 2 additions & 2 deletions src/apis/fetchSeachList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios from "axios";

import { BASE_URL, END_POINTS } from "@/constants/api";
import axios from "axios";

export const fetchSearchList = async (
location: string | null,
Expand Down Expand Up @@ -37,6 +36,7 @@ export const fetchSearchList = async (
},
},
);
console.log("response data", response);
return response.data.data;
} catch (error) {
throw new Error("호텔 검색에 실패했습니다");
Expand Down
Binary file removed src/assets/EventImages/firstMonth.png
Binary file not shown.
Binary file removed src/assets/EventImages/secondMonth.png
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First1.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First10.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First11.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First12.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First13.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First14.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First15.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First2.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First3.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First4.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First5.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First6.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First7.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First8.jpg
Binary file not shown.
Binary file removed src/assets/firstFestivalImages/First9.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second1.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second10.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second11.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second12.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second13.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second14.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second15.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second2.jpg
Binary file not shown.
Binary file removed src/assets/secondFestivalImages/Second3.jpg
Diff not rendered.
Binary file removed src/assets/secondFestivalImages/Second4.jpg
Diff not rendered.
Binary file removed src/assets/secondFestivalImages/Second5.jpg
Diff not rendered.
Binary file removed src/assets/secondFestivalImages/Second6.jpg
Diff not rendered.
Binary file removed src/assets/secondFestivalImages/Second7.jpg
Diff not rendered.
Binary file removed src/assets/secondFestivalImages/Second8.jpg
Diff not rendered.
Binary file removed src/assets/secondFestivalImages/Second9.jpg
Diff not rendered.
4 changes: 2 additions & 2 deletions src/components/carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Carousel = ({
const slideList = infinite
? [images.at(-1), ...images, images.at(0)]
: images;
console.log(images.at(-1));

const { slideWidth, sliderRef } = useCarouselSize();

const {
Expand All @@ -39,7 +39,7 @@ const Carousel = ({
infinite,
slideWidth,
});
console.log("currentIndex", currentIndex);

return (
<S.CarouselContainer $height={height}>
<S.SliderWrapper>
Expand Down
18 changes: 4 additions & 14 deletions src/components/layout/header/HeaderTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ const Header = ({ text, handleBackClick }: HeaderProps) => {
let title = "";
let undo = true;

if (pathname.includes(PATH.MAIN_DETAIL)) {
const id = params.get("id");
undo = true;
if (id === "0") {
title = "봄 여행 숙소 추천";
} else if (id === "1") {
title = "성수기 숙소 예약 놓쳤다면?";
if (pathname.includes(PATH.WRITE_TRANSFER_PRICE)) {
const hotelName = params.get("hotelName");
if (hotelName) {
title = hotelName;
}
}

Expand All @@ -34,13 +31,6 @@ const Header = ({ text, handleBackClick }: HeaderProps) => {
title = "판매내역 상세";
}

if (pathname.includes(PATH.WRITE_TRANSFER_PRICE)) {
const hotelName = params.get("id");
if (hotelName) {
title = hotelName;
}
}

switch (pathname) {
case PATH.ROOT:
alarmIC = false;
Expand Down
1 change: 0 additions & 1 deletion src/constants/path.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export const PATH = {
ROOT: "/",
MAIN_DETAIL: "/main-detail",
ALARM: "/alarm",
SEARCHLIST: "/search",
SEARCH_FILTER: "/search/filter",
Expand Down
1 change: 0 additions & 1 deletion src/hooks/common/useCarouselSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const useCarouselSize = () => {

const parentWidth =
sliderRef.current.parentElement?.getBoundingClientRect().width ?? 0;
console.dir(sliderRef.current.parentElement);
setSlideWidth(parentWidth);
};

Expand Down
26 changes: 13 additions & 13 deletions src/pages/homePage/Home.style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from "styled-components";

export const Container = styled.section<{ $weekLength: undefined | number }>`
background-color: ${({ theme }) => theme.color.greyScale7};
background-color: ${({ theme }) => theme.color.greyScale6};
padding-top: 80px;
padding-bottom: ${({ $weekLength }) => !$weekLength && "200px"};
Expand All @@ -21,10 +21,15 @@ export const Container = styled.section<{ $weekLength: undefined | number }>`
`;

export const SaleCarouselContainer = styled.div`
width: 100%;
width: calc(100% - 40px);
height: 434px;
background-color: white;
margin-bottom: 70px;
margin-top: 10px;
margin-bottom: 32px;
border-radius: 12px;
overflow: hidden;
box-shadow: 4px 4px 10px 0 rgba(0, 0, 0, 0.1);
`;

export const TextSlider = styled.div`
Expand All @@ -47,20 +52,15 @@ export const TextSlider = styled.div`

export const WeekendCarouselContainer = styled.div`
width: 100%;
height: 520px;
height: 467px;
margin: 0 20px;
background-color: white;
padding-bottom: 100px;
margin-bottom: 60px;
`;

export const TitleSection = styled.div`
margin: 40px 20px 8px;
margin: 40px 20px 0;
height: 46px;
font-size: 18px;
font-weight: 800;
`;

export const SubTitle = styled.div`
width: 100%;
${({ theme }) => theme.typo.body3}
margin: 0 20px 25px;
`;
68 changes: 24 additions & 44 deletions src/pages/homePage/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
import { fetchMainItem } from "@/apis/fetchMainItems";
import { locale } from "@/constants/locale";
import { useSuspenseQuery } from "@tanstack/react-query";
import { LocaleItem, WeekendItem } from "@/types/saleSection";
import { useState } from "react";

import EventCarousel from "./eventCarousel/EventCarousel";
import * as S from "./Home.style";
import ItemCarousel from "./itemCarousel/ItemCarousel";
import MainHeader from "./mainHeader/MainHeader";
import NavToSearchSection from "./navToSearchSection/NavToSearchSection";
import PercentAnimator from "./percentAnimator/PercentAnimator";
import SequenceSection from "./sequenceSection/SequenceSection";
import TextLocaleAnimator from "./textAnimator/TextAnimator";
import TitleSection from "./titleSection/TitleSection";
import WeekendCarousel from "./weekendCarousel/WeekendCarousel";

import { fetchMainItem } from "@/apis/fetchMainItems";
import secondMonth from "@/assets/EventImages/secondMonth.png";
import { LocaleItem, WeekendItem } from "@/types/saleSection";
interface EventItem {
id: number;
image: string;
title1: string;
title2: string;
}

const Home = () => {
const { data: mainData } = useSuspenseQuery({
queryKey: ["main"],
queryFn: fetchMainItem,
});
const [localeProds, weekendProds] = mainData;
const EventCarouselContents: EventItem[] = [
{
id: 1,
image: secondMonth,
title1: "성수기 숙소 예약 놓쳤다면?",
title2: "황금연휴 호캉스 추천",
},
];

// 지역 별 할인 관련 데이터
const localeEntries: [number, string, LocaleItem[]][] = Object.entries(
localeProds,
Expand All @@ -42,14 +29,15 @@ const Home = () => {
.map((v, i) => [i, v[0], v[1]]);

const [localeAndHotel] = useState(localeEntries);
console.log("localeEntries", localeEntries);

const [currentLocale, setCurrentLocale] = useState<
[number, string, LocaleItem[]]
>(localeAndHotel[0]);
const indicatorRange = new Array(localeAndHotel.length)
.fill("")
.map((_, i) => i);

// 주말 특가 관련 데이터
const WeekendMapped: [number, WeekendItem][] | undefined = weekendProds?.map(
(v, i) => [i, v],
);
Expand All @@ -58,34 +46,12 @@ const Home = () => {
return (
<S.Container $weekLength={weekendHotels?.length}>
<MainHeader />
<TitleSection />
<NavToSearchSection />
<EventCarousel
EventCarouselContents={EventCarouselContents}
height={304}
arrows={false}
infinite={true}
innerShadow={true}
draggable={true}
auto={true}
/>

{weekendHotels && weekendHotels.length !== 0 && (
<S.WeekendCarouselContainer className="week-container">
<S.TitleSection>프리미엄 호캉스</S.TitleSection>
<S.SubTitle>퍼센특가로 만나는 4-5성급 호텔 모음 </S.SubTitle>

<WeekendCarousel
weekendHotels={weekendHotels}
onChangeLocale={setCurrentLocale}
height={343}
arrows={true}
infinite={false}
draggable={true}
/>
</S.WeekendCarouselContainer>
)}
<S.SaleCarouselContainer>
<S.TextSlider>
<TextLocaleAnimator text={locale[currentLocale[1]]} />
<span>지역</span>
<PercentAnimator
percent={currentLocale[2][0]?.salePercentage}
Expand All @@ -111,6 +77,20 @@ const Home = () => {
onSetSequence={setCurrentLocale}
/>
</S.SaleCarouselContainer>
{weekendHotels && weekendHotels.length !== 0 && (
<S.WeekendCarouselContainer className="week-container">
<S.TitleSection>주말 호캉스 추천</S.TitleSection>

<WeekendCarousel
weekendHotels={weekendHotels}
onChangeLocale={setCurrentLocale}
height={343}
arrows={true}
infinite={false}
draggable={true}
/>
</S.WeekendCarouselContainer>
)}
</S.Container>
);
};
Expand Down
122 changes: 0 additions & 122 deletions src/pages/homePage/eventCarousel/EventCarousel.style.ts

This file was deleted.

Loading

0 comments on commit 17240c4

Please sign in to comment.