-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
167 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/pages/NewPartyPage/PartyType/PartyTypeButton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Dispatch, memo, SetStateAction, useCallback } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import clsx from "clsx"; | ||
|
||
interface Props { | ||
type: string; | ||
title: string; | ||
desc: string[]; | ||
name: string; | ||
partyType: string; | ||
setPartyType: Dispatch<SetStateAction<string>>; | ||
} | ||
|
||
function PartyTypeButton({ | ||
type, | ||
title, | ||
desc, | ||
name, | ||
partyType, | ||
setPartyType, | ||
}: Props) { | ||
const navigation = useNavigate(); | ||
|
||
const clickButton = useCallback(() => { | ||
setPartyType(type); | ||
navigation("/party/new/1?region=null&member=null&date=null&driverId=null"); | ||
}, [type]); | ||
|
||
const touchHandler = useCallback(() => { | ||
setPartyType(type); | ||
}, [type]); | ||
|
||
return ( | ||
<div | ||
className={clsx( | ||
"group w-full md:max-w-[360px] px-6 md:px-[30px] pb-[30px] md:pb-[240px] pt-[30px] md:pt-[100px] rounded-2xl relative md:hover:bg-skyblue md:hover:ring-[2px] ring-primary cursor-default", | ||
partyType === type ? "bg-skyblue ring-[2px]" : "bg-[#F8F9FD] ring-0" | ||
)} | ||
onTouchStart={touchHandler} | ||
> | ||
<span | ||
className={clsx( | ||
"px-2 py-0.5 text-white font-medium text-[10px] leading-[14px] rounded-[4px] md:group-hover:bg-primary", | ||
partyType === type ? "bg-primary" : "bg-[#333333]" | ||
)} | ||
> | ||
{type} | ||
</span> | ||
<p className="font-semibold text-lg text-[#333333] mt-2.5 mb-4"> | ||
{title} | ||
</p> | ||
<ul className="list-disc px-4 font-normal text-xs text-darkgray marker:text-[8px]"> | ||
<li className="whitespace-pre-wrap">{desc[0] || ""}</li> | ||
<li className="whitespace-pre-wrap mt-1.5">{desc[1] || ""}</li> | ||
</ul> | ||
<button | ||
className={clsx( | ||
"hidden md:block absolute left-[30px] bottom-[30px] h-[58px] rounded-2xl font-medium text-lg md:group-hover:bg-primary md:group-hover:text-white", | ||
partyType === type | ||
? "bg-primary text-white" | ||
: "bg-[#EEEEEE] text-[#999999]" | ||
)} | ||
style={{ width: "calc(100% - 60px)" }} | ||
onClick={clickButton} | ||
> | ||
{name} | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default memo(PartyTypeButton); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Dispatch, memo, SetStateAction, useEffect, useMemo } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { BottomButton, Title } from "@/components"; | ||
import PartyTypeButton from "./PartyTypeButton"; | ||
|
||
interface Props { | ||
partyType: string; | ||
setPartyType: Dispatch<SetStateAction<string>>; | ||
} | ||
|
||
function PartyType({ partyType, setPartyType }: Props) { | ||
const navigation = useNavigate(); | ||
|
||
const partyTypeList = useMemo( | ||
() => [ | ||
{ | ||
type: "New", | ||
title: "새로운 여행자들과 떠나는 여행 🚀", | ||
desc: [ | ||
"예약자님의 계획으로 말랑트립의 동행자들과\n새로운 만남으로 여행을 떠납니다.", | ||
"택시 정원 한도로 동행자들과 여행이 가능하며\n팀원들 간 계획 수정도 가능합니다.", | ||
], | ||
name: "새로운 사람과 여행가기", | ||
}, | ||
{ | ||
type: "Friend", | ||
title: "나의 지인들과 소중한 여행 🚕", | ||
desc: [ | ||
"예약자와 지인들의 원하는 일정으로 드라이버와\n함께 단독으로 이용합니다.", | ||
"택시 정원 한도로 동행자들과 여행이 가능합니다.", | ||
], | ||
name: "나의 지인과 여행가기", | ||
}, | ||
], | ||
[] | ||
); | ||
|
||
useEffect(() => { | ||
setPartyType(""); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<Title title="어떤 여행인가요?" className="mx-4" /> | ||
<div className="mt-[30px] md:mt-[60px] flex flex-col md:flex-row gap-[14px] md:gap-[22px] mx-6"> | ||
{partyTypeList.map((item) => ( | ||
<PartyTypeButton | ||
key={item.type} | ||
partyType={partyType} | ||
setPartyType={setPartyType} | ||
{...item} | ||
/> | ||
))} | ||
</div> | ||
<BottomButton | ||
text="여행가기" | ||
disabled={partyType === ""} | ||
onClick={() => | ||
navigation( | ||
"/party/new/1?region=null&member=null&date=null&driverId=null" | ||
) | ||
} | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
export default memo(PartyType); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters