Skip to content

Commit

Permalink
Merge pull request #28 from Nico1eKim/feat/my-artist-event
Browse files Browse the repository at this point in the history
✨ feat: my-artist-evnet 구현
  • Loading branch information
gw-lim authored Jan 30, 2024
2 parents 5f5af68 + 4248b39 commit c200b6e
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 55 deletions.
17 changes: 10 additions & 7 deletions app/(route)/_components/carousel/FavArtistEventsCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import Link from "next/link";
import { useState } from "react";
import Carousel from "@/components/Carousel";
import EventCard from "@/components/card/EventCard";
import { EventMockData } from "../EventMockData";
import { EventMockData } from "@/components/card/EventMockData";
import VerticalEventCard from "@/components/card/VerticalEventCard";

const FavArtistEventsCarousel = () => {
// 추후 next auth로 변경 예정
Expand All @@ -17,14 +17,17 @@ const FavArtistEventsCarousel = () => {

return (
<>
<h2>좋아요한 아티스트의 새 행사</h2>
<div className="flex justify-between">
<h2>좋아요한 아티스트의 새 행사</h2>
<Link href="/my-artist-event">전체보기</Link>
</div>
{status ? (
hasFavoriteEvents ? (
<Carousel customSettings={{ dots: true, infinite: false }}>
<EventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
<EventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
<EventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
<EventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
<VerticalEventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
<VerticalEventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
<VerticalEventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
<VerticalEventCard placeName="카페" artistName="아티스트" eventType="생일 카페" address="주소" startDate="날짜" endDate="날짜" />
</Carousel>
) : (
<NoFavCard buttonName="아티스트 둘러보기" href={"/setting/artist"} />
Expand Down
6 changes: 3 additions & 3 deletions app/(route)/_components/carousel/NewestEventsCarousel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Carousel from "@/components/Carousel";
import EventCard from "@/components/card/EventCard";
import { EventMockData } from "../EventMockData";
import { EventMockData } from "@/components/card/EventMockData";
import VerticalEventCard from "@/components/card/VerticalEventCard";

const NewestEventsCarousel = () => {
return (
Expand All @@ -18,7 +18,7 @@ const NewestEvents = () => {
<>
{newestEvents.map((event, index) => (
<div key={index}>
<EventCard
<VerticalEventCard
placeName={event.placeName}
artistName={event.artistName}
eventType={event.eventType}
Expand Down
6 changes: 3 additions & 3 deletions app/(route)/_components/carousel/PopularEventsCarousel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Carousel from "@/components/Carousel";
import EventCard from "@/components/card/EventCard";
import { EventMockData } from "../EventMockData";
import { EventMockData } from "@/components/card/EventMockData";
import VerticalEventCard from "@/components/card/VerticalEventCard";

const PopularEventsCarousel = () => {
return (
Expand All @@ -18,7 +18,7 @@ const PopularEvents = () => {
<>
{popularEvents.map((event, index) => (
<div key={index}>
<EventCard
<VerticalEventCard
placeName={event.placeName}
artistName={event.artistName}
eventType={event.eventType}
Expand Down
26 changes: 26 additions & 0 deletions app/(route)/my-artist-event/_components/MyArtistEvent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { EventMockData } from "@/components/card/EventMockData";
import HorizontalEventCard from "@/components/card/HorizontalEventCard";

const MyArtistEvent = () => {
// 좋아요 한 아티스트의 새 행사 로직은 추후 구현

return (
<>
{EventMockData.map((event, index) => (
<div key={index}>
<HorizontalEventCard
placeName={event.placeName}
artistName={event.artistName}
eventType={event.eventType}
address={event.address}
startDate={event.startDate}
endDate={event.endDate}
gifts={event.gifts}
/>
</div>
))}
</>
);
};

export default MyArtistEvent;
15 changes: 15 additions & 0 deletions app/(route)/my-artist-event/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Header from "@/components/Header";
import MyArtistEvent from "./_components/MyArtistEvent";

const MyArtistEventPage = () => {
return (
<div className="flex h-dvh w-dvw flex-col px-20 pt-32">
<div className="flex items-center gap-8 self-start pb-20">
<Header />
</div>
<MyArtistEvent />
</div>
);
};

export default MyArtistEventPage;
4 changes: 2 additions & 2 deletions app/(route)/mypage/_components/EventCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useState } from "react";
import Calendar from "react-calendar";
import "react-calendar/dist/Calendar.css";
import EventCard from "@/components/card/EventCard";
import VerticalEventCard from "@/components/card/VerticalEventCard";

interface ScheduleData {
placeName: string;
Expand Down Expand Up @@ -76,7 +76,7 @@ const EventCalendar = () => {
{mockData
.filter((event) => !date || (new Date(event.startDate).getTime() <= date.getTime() && new Date(event.endDate).getTime() >= date.getTime()))
.map((event, index) => (
<EventCard
<VerticalEventCard
key={index}
placeName={event.placeName}
artistName={event.artistName}
Expand Down
1 change: 1 addition & 0 deletions app/_components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const TITLE: { [a: string]: string } = {
"/setting/profile": "프로필 수정",
"/setting/favorite": "좋아하는 아티스트 수정",
"/mypage": "마이페이지",
"/my-artist-event": "좋아요한 아티스트의 새 행사",
};

const Header = () => {
Expand Down
2 changes: 1 addition & 1 deletion app/_components/artist-list/ArtistList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { useState } from "react";
import InfiniteScroll from "react-infinite-scroller";
import { ProfileMockData } from "../card/ProfileMockData";
import ArtistProfile from "./ArtistProfile";
import { ProfileMockData } from "./ProfileMockData";

const ArtistList = () => {
const [artists, setArtists] = useState(ProfileMockData);
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions app/_components/card/Chip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Chip = ({ chipName }: { chipName: string }) => {
// bg 색도 받아와야함..!?
return <div className="gap-10 flex items-center rounded-[4px] bg-[#C3C3C3] px-4 py-0">{chipName}</div>;
};

export default Chip;
36 changes: 0 additions & 36 deletions app/_components/card/EventCard.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const EventMockData = [
address: "마포구",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "윤정한 카페",
Expand All @@ -15,6 +16,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "홍지수 카페",
Expand All @@ -24,6 +26,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "문준휘 카페",
Expand All @@ -33,6 +36,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "권순영 카페",
Expand All @@ -42,6 +46,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "전원우 카페",
Expand All @@ -51,6 +56,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "이지훈 카페",
Expand All @@ -60,24 +66,27 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "이지훈 카페",
artistName: "이지훈",
placeName: "서명호 카페",
artistName: "서명호",
eventType: "생일카페",
address: "마포구",
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "최승철 카페",
placeName: "김민규 카페",
artistName: "김민규",
eventType: "생일카페",
address: "마포구",
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "이석민 카페",
Expand All @@ -87,6 +96,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "부승관 카페",
Expand All @@ -96,6 +106,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "최한솔 카페",
Expand All @@ -105,6 +116,7 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
{
placeName: "이찬 카페",
Expand All @@ -114,5 +126,6 @@ export const EventMockData = [
date: "01.19 ~ 01.20",
startDate: "2024-01-28",
endDate: "2024-01-30",
gifts: ["컵홀더", "포토카드", "엽서", "스티커"],
},
];
36 changes: 36 additions & 0 deletions app/_components/card/HorizontalEventCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { EventCardProps } from "@/types/index";
import Chip from "./Chip";

const HorizontalEventCard = ({ placeName, artistName, eventType, address, startDate, endDate, gifts }: EventCardProps) => {
// "2024-" 부분을 제외하고 날짜를 보여주기 위해 Date 객체 사용
const formattedStartDate = new Date(startDate).toLocaleDateString(undefined, { month: "2-digit", day: "2-digit" });
const formattedEndDate = new Date(endDate).toLocaleDateString(undefined, { month: "2-digit", day: "2-digit" });

return (
<div className="flex w-320 items-center gap-12 self-stretch border-b border-solid border-[#E0E2E6] py-12">
<div className="h-112 w-84 bg-[#e7e7e7]" />
<div className="flex flex-col gap-4">
<p>{placeName}</p>
<div className="flex items-center gap-8">
<p>{artistName}</p>
<Chip chipName={eventType} />
</div>
<div className="flex">
<p className="border-r border-solid border-black pr-4">
{formattedStartDate} ~ {formattedEndDate}
</p>
<p className="pl-4">{address}</p>
</div>
<div className="flex gap-4">
{gifts?.map((gift, index) => (
<div key={index}>
<Chip chipName={gift} />
</div>
))}
</div>
</div>
</div>
);
};

export default HorizontalEventCard;
29 changes: 29 additions & 0 deletions app/_components/card/VerticalEventCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { EventCardProps } from "@/types/index";
import Chip from "./Chip";

const VerticalEventCard = ({ placeName, artistName, eventType, address, startDate, endDate }: EventCardProps) => {
// "2024-" 부분을 제외하고 날짜를 보여주기 위해 Date 객체 사용
const formattedStartDate = new Date(startDate).toLocaleDateString(undefined, { month: "2-digit", day: "2-digit" });
const formattedEndDate = new Date(endDate).toLocaleDateString(undefined, { month: "2-digit", day: "2-digit" });

return (
<div className="flex w-180 flex-col gap-8 border border-solid border-black p-[10px]">
<div className="h-160 bg-[#e7e7e7]" />
<div className="flex flex-col gap-4">
<p>{placeName}</p>
<div className="flex">
<p className="border-r border-solid border-black pr-4">
{formattedStartDate} ~ {formattedEndDate}
</p>
<p className="pl-4">{address}</p>
</div>
<div className="flex gap-4">
<p>{artistName}</p>
<Chip chipName={eventType} />
</div>
</div>
</div>
);
};

export default VerticalEventCard;
10 changes: 10 additions & 0 deletions app/_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ export interface SignUpFormType {
nickName: string;
myArtists: string[] | [];
}

export interface EventCardProps {
placeName: string;
artistName: string;
eventType: string;
address: string;
startDate: string;
endDate: string;
gifts?: string[];
}

0 comments on commit c200b6e

Please sign in to comment.