Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: create home #29

Merged
merged 36 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7835264
Fix: edit typography
Yamyam-code Jan 2, 2024
cc41f3e
Feat: voteathome markup
Yamyam-code Jan 2, 2024
52e1ccb
Refactor: vote-at-home separate components
Yamyam-code Jan 3, 2024
b068c20
Feat: recommended-list at home markup
Yamyam-code Jan 3, 2024
0efb005
Fix: edit Home padding
Yamyam-code Jan 4, 2024
1ac0d8a
Conf: pull dev
Yamyam-code Jan 4, 2024
8f8f81d
Feat: create toolbar and searchbar
Yamyam-code Jan 4, 2024
2cdd1d8
Merge branch 'dev' of https://github.com/Strong-Potato/TripVote-FE in…
Yamyam-code Jan 4, 2024
0007878
Feat: recommendedItem connect msw
Yamyam-code Jan 5, 2024
f78d86c
Feat: voteathome markup
Yamyam-code Jan 2, 2024
8fac15b
Refactor: vote-at-home separate components
Yamyam-code Jan 3, 2024
b5004c7
Feat: recommended-list at home markup
Yamyam-code Jan 3, 2024
446899c
Fix: edit Home padding
Yamyam-code Jan 4, 2024
fc1ff9c
Feat: create toolbar and searchbar
Yamyam-code Jan 4, 2024
2987154
Feat: recommendedItem connect msw
Yamyam-code Jan 5, 2024
1db6bf3
Feat: home connect msw
Yamyam-code Jan 5, 2024
6666514
Fix: resolve conflict
Yamyam-code Jan 5, 2024
fb6a341
Fix: reinstall package-lock.json
Yamyam-code Jan 5, 2024
c966bb5
Fix: edit mockServiceWorker quotation marks
Yamyam-code Jan 5, 2024
5c25fab
Feat: voteathome markup
Yamyam-code Jan 2, 2024
480dcc9
Refactor: vote-at-home separate components
Yamyam-code Jan 3, 2024
b3aaec5
Feat: recommended-list at home markup
Yamyam-code Jan 3, 2024
781d0ac
Fix: edit Home padding
Yamyam-code Jan 4, 2024
18c4420
Feat: create toolbar and searchbar
Yamyam-code Jan 4, 2024
55c39db
Feat: recommendedItem connect msw
Yamyam-code Jan 5, 2024
1ad26c2
Feat: home connect msw
Yamyam-code Jan 5, 2024
c530861
Feat: voteathome markup
Yamyam-code Jan 2, 2024
a993651
Refactor: vote-at-home separate components
Yamyam-code Jan 3, 2024
9bbb77b
Feat: recommended-list at home markup
Yamyam-code Jan 3, 2024
8188eac
Fix: edit Home padding
Yamyam-code Jan 4, 2024
75b2c28
Feat: create toolbar and searchbar
Yamyam-code Jan 4, 2024
a88e9ba
Feat: recommendedItem connect msw
Yamyam-code Jan 5, 2024
be4c8fb
Fix: reinstall package-lock.json
Yamyam-code Jan 5, 2024
10e7e8b
Merge branch '6-feat-create-home' of https://github.com/Strong-Potato…
Yamyam-code Jan 6, 2024
a246420
Fix: delete slideButton
Yamyam-code Jan 6, 2024
b6778d1
Merge branch 'dev' into 6-feat-create-home
Yamyam-code Jan 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/mapIconHome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/tripVoteLogoHome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
position: fixed;
bottom: 0;

max-width: 500px;
max-width: 45rem;
width: 100%;
height: 56px;
height: 5.6rem;

display: flex;
box-shadow:
0px -2px 8px 0px rgba(20, 20, 20, 0.04),
0px -1px 1px 0px rgba(20, 20, 20, 0.02);

background-color: $neutral0;

a {
flex-grow: 1;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@use "@/sass" as *;

.container {
min-width: 14.4rem;

display: flex;
flex-direction: column;
gap: 8px;

.item_img {
width: 100%;
height: 14.4rem;

border-radius: 1.6rem;
}

.text_box {
display: flex;
flex-direction: column;

@include typography(captionSmall);

.gray {
color: $neutral400;
}

.item_title {
@include typography(titleSmall);
}

.item_score {
display: flex;
align-items: center;
gap: 4px;

.score {
display: flex;
align-items: center;

@include typography(captionMidium);
}
.star {
padding: 2px;
color: $etc0;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { FaStar } from "react-icons/fa";
import { Link } from "react-router-dom";

import styles from "./RecommendedItem.module.scss";

import { RecommendedItemDataType } from "@/types/home";

interface PropsType {
data: RecommendedItemDataType;
}

function RecommendedItem(data: PropsType) {
const linkURL = `/detail/${data.data.id}`;
const imageAlt = `${data.data.title}의 사진`;

return (
<div className={styles.container}>
<Link to={linkURL}>
<img
className={styles.item_img}
src={data.data.imageURL}
alt={imageAlt}
/>
<div className={styles.text_box}>
<span className={styles.item_title}>{data.data.title}</span>
<span className={styles.gray}>{data.data.location}</span>
<div className={styles.item_score}>
<p className={styles.score}>
<span className={styles.star}>
<FaStar />
</span>
<span>{data.data.score}</span>
</p>
<span className={styles.gray}>({data.data.reviewNumber})</span>
</div>
</div>
</Link>
</div>
);
}

export default RecommendedItem;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@use "@/sass" as *;

.container {
display: flex;
gap: 16px;

padding: 0 20px;

overflow-x: scroll;
}
35 changes: 35 additions & 0 deletions src/components/Home/RecommendedItemList/RecommendedItemList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useEffect, useState } from "react";

import styles from "./RecommendedItemList.module.scss";

import { getData } from "@/mocks/handlers/home";

import RecommendedItem from "./RecommendedItem/RecommendedItem";

import { RecommendedItemDataType } from "@/types/home";

interface PropsType {
apiNum: number;
}

function RecommendedItemList(apiNum: PropsType) {
const [data, setData] = useState<RecommendedItemDataType[]>();

useEffect(() => {
getData<RecommendedItemDataType[] | undefined>(
`home/recommendedItem/${apiNum.apiNum}`,
setData,
);
}, [apiNum]);

return (
<div className={styles.container}>
{data &&
data.map((data, i) => (
<RecommendedItem data={data} key={data.title + i} />
))}
</div>
);
}

export default RecommendedItemList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@use "@/sass" as *;

.container {
position: relative;

min-width: 12.2rem;
height: 12.2rem;

border-radius: 12.2rem;

overflow: hidden;

color: $neutral0;

@include typography(titleMedium);

img {
width: 100%;
height: 100%;
}

.text_wall {
position: absolute;
top: 0;
left: 0;

background-color: rgba(0, 0, 0, 0.2);

width: 100%;
height: 100%;
}

span {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Link } from "react-router-dom";

import styles from "./RecommendedLocation.module.scss";

import { LocationDataType } from "@/types/home";

interface PropsType {
data: LocationDataType;
}

function RecommendedLocation(data: PropsType) {
const link = `/search/${data.data.location}`;
const imageAlt = `${data.data.location}의 사진`;

return (
<div className={styles.container}>
<Link to={link}>
<img src={data.data.imageURL} alt={imageAlt}></img>
<div className={styles.text_wall} />
<span>{data.data.location}</span>
</Link>
</div>
);
}

export default RecommendedLocation;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@use "@/sass" as *;

.container {
display: flex;
gap: 8px;

padding: 0 20px;

overflow-x: scroll;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useEffect, useState } from "react";

import styles from "./RecommendedLocationList.module.scss";

import { getData } from "@/mocks/handlers/home";

import RecommendedLocation from "./RecommendedLocation/RecommendedLocation";

import { LocationDataType } from "@/types/home";

function RecommendedLocationList() {
const [data, setData] = useState<LocationDataType[]>();

useEffect(() => {
getData<LocationDataType[] | undefined>(
`home/recommendedLocation`,
setData,
);
}, []);

return (
<div className={styles.container}>
{data &&
data.map((data, i) => (
<RecommendedLocation data={data} key={data.location + i} />
))}
</div>
);
}

export default RecommendedLocationList;
26 changes: 26 additions & 0 deletions src/components/Home/SearchBarAtHome/SearchBarAtHome.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@use "@/sass" as *;

.container {
width: 100%;

padding: 0 20px;

.search_bar {
width: 100%;

display: flex;
justify-content: space-between;

padding: 12px 24px;

border: 1px solid $primary300;
border-radius: 10rem;
color: $neutral300;

@include typography(subTitle);

.search_icon {
font-size: 2.4rem;
}
}
}
19 changes: 19 additions & 0 deletions src/components/Home/SearchBarAtHome/SearchBarAtHome.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { IoSearchSharp } from "react-icons/io5";
import { Link } from "react-router-dom";

import styles from "./SearchBarAtHome.module.scss";

function SearchBarAtHome() {
return (
<div className={styles.container}>
<Link to="/search" className={styles.search_bar}>
<span>어디로 떠나시나요?</span>
<p className={styles.search_icon}>
<IoSearchSharp />
</p>
</Link>
</div>
);
}

export default SearchBarAtHome;
24 changes: 24 additions & 0 deletions src/components/Home/TabBar/TabBar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@use "@/sass" as *;

.container {
position: fixed;
top: 0;

width: 100%;
max-width: 45rem;
height: 5.6rem;

padding: 20px 16px;

background-color: $neutral0;

z-index: 10;

.icons {
display: flex;
justify-content: flex-end;
gap: 12px;

font-size: 2.4rem;
}
}
20 changes: 20 additions & 0 deletions src/components/Home/TabBar/TabBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { AiOutlineBell } from "react-icons/ai";
import { IoSearchSharp } from "react-icons/io5";
import { Link } from "react-router-dom";

import styles from "./TabBar.module.scss";

function TabBar() {
return (
<div className={styles.container}>
<div className={styles.icons}>
<Link to="/search">
<IoSearchSharp />
</Link>
<AiOutlineBell />
</div>
</div>
);
}

export default TabBar;
10 changes: 10 additions & 0 deletions src/components/Home/TripSpaceAtHome/TripSpaceAtHome.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@use "@/sass" as *;

.container {
display: flex;
gap: 8px;

padding: 0 20px;

overflow-x: scroll;
}
Loading