diff --git a/instructions/changelog.md b/instructions/changelog.md new file mode 100644 index 0000000..0dacf5a --- /dev/null +++ b/instructions/changelog.md @@ -0,0 +1,35 @@ +# Changelog + +## [0.1.0] - 2024-01-25 + +### Added +- Created new EventDetailsCover component + - Displays event title, date/time, and location + - Optional cover image with hide/show functionality + - Responsive design following Figma specs + - TypeScript interfaces for type safety + - Tailwind CSS for styling + +### New Files +- `/src/components/EventDetailsCover/` + - `EventDetailsCover.tsx` - Main component + - `types.ts` - TypeScript interfaces + - `index.ts` - Barrel exports +- `/src/utils/dateFormatter.ts` - Date formatting utility +- `/src/stories/EventDetailsCover.stories.tsx` - Storybook stories + +### Features +- Cover image with optional hide/show functionality +- Formatted date/time display +- Location details with venue, address, city, state +- Icon integration for calendar and location +- Storybook documentation with two variants: + - Default (with cover image) + - Without cover image + +### Technical Details +- Built with Next.js Image component for optimized images +- TypeScript for type safety +- Tailwind CSS for styling +- Storybook integration for component documentation +- Modular file structure following project conventions diff --git a/instructions/instructions.md b/instructions/instructions.md new file mode 100644 index 0000000..fe84c2e --- /dev/null +++ b/instructions/instructions.md @@ -0,0 +1,108 @@ +## Description: +Event details cover component will show the image, title, date and location of the event. + +Mock the data in the component. + +Ignore the right side of the desktop page, that is a separate component. For now add a div with the size of the right component to make it look like the design. + +Add a prop to the component called hideCoverImage: boolean + +If the hideCoverImage is true then dont show the image. + +## Acceptance Criteria +The result should follow the figma design. + +### Testing +Add the respective story using storybook for this issue + + +## Current File Structure + +. +├── README.md +├── chromatic.config.json +├── components.json +├── eslint.config.mjs +├── instructions +│   └── instructions.md +├── next.config.js +├── next.config.ts +├── package-lock.json +├── package.json +├── postcss.config.mjs +├── public +│   ├── Frame.svg +│   ├── HallosLetters.svg +│   ├── LogoHallos.svg +│   ├── Spain.svg +│   ├── calendar.svg +│   ├── file.svg +│   ├── globe.svg +│   ├── hallos.png +│   ├── images +│   │   ├── Facebook.png +│   │   ├── GoldRogerProfile2.png +│   │   ├── GroupBookTicketIcon.png +│   │   ├── Instagram.png +│   │   ├── Location.png +│   │   ├── Map.png +│   │   ├── Pinterest.png +│   │   ├── TikTok.png +│   │   ├── Twitter.png +│   │   ├── VISA.png +│   │   ├── dollar.png +│   │   ├── eth.png +│   │   ├── hallos.png +│   │   └── vueltos-un-colocho.png +│   ├── location.svg +│   ├── next.svg +│   ├── nightParty1.png +│   ├── nightParty2.png +│   ├── qr.svg +│   ├── tico-blockchain.jpg +│   ├── vercel.svg +│   └── window.svg +├── src +│   ├── app +│   │   ├── GroupBookTicketIcon.png +│   │   ├── events +│   │   ├── example +│   │   ├── favicon.ico +│   │   ├── globals.css +│   │   ├── layout.tsx +│   │   └── page.tsx +│   ├── components +│   │   ├── Input +│   │   ├── PaymentMethod.tsx +│   │   ├── common +│   │   ├── forms +│   │   ├── layout +│   │   └── ui +│   ├── constants +│   │   ├── countries.ts +│   │   └── formInputs.ts +│   ├── icons +│   │   ├── Calendar.tsx +│   │   ├── Facebook.tsx +│   │   ├── Filter.tsx +│   │   ├── GitHub.tsx +│   │   ├── Instagram.tsx +│   │   ├── Location.tsx +│   │   ├── Loupe.tsx +│   │   ├── PlusMinus.tsx +│   │   ├── Twitter.tsx +│   │   └── index.ts +│   ├── lib +│   │   └── utils.ts +│   ├── stories +│   │   ├── Colors.mdx +│   │   ├── Configure.mdx +│   │   └── assets +│   ├── types +│   │   └── faq.type.ts +│   └── utils +│   ├── events.ts +│   └── faqs.ts +├── tailwind.config.ts +├── tsconfig.json +└── yarn.lock \ No newline at end of file diff --git a/src/components/EventDetailsCover/EventDetailsCover.tsx b/src/components/EventDetailsCover/EventDetailsCover.tsx new file mode 100644 index 0000000..9c553ab --- /dev/null +++ b/src/components/EventDetailsCover/EventDetailsCover.tsx @@ -0,0 +1,57 @@ +import Image from 'next/image'; +import { EventDetailsCoverProps } from './types'; +import { formatEventDate } from '@/utils/dateFormatter'; +import { Calendar, Location } from '@/icons'; + +export const EventDetailsCover = ({ + title, + startDate, + endDate, + location, + coverImage, + hideCoverImage = false +}: EventDetailsCoverProps) => { + return ( +
+ {/* Cover Image */} + {!hideCoverImage && coverImage && ( +
+ {title} +
+ )} + + {/* Event Details */} +
+

{title}

+ + {/* Date and Time */} +
+ + + {formatEventDate(startDate, endDate)} + +
+ + {/* Location */} +
+ +
+ {location.venue} + + {location.address} + + + {`${location.city}, ${location.state} ${location.zipCode}`} + +
+
+
+
+ ); +}; \ No newline at end of file diff --git a/src/components/EventDetailsCover/index.ts b/src/components/EventDetailsCover/index.ts new file mode 100644 index 0000000..6655a00 --- /dev/null +++ b/src/components/EventDetailsCover/index.ts @@ -0,0 +1,2 @@ +export * from './EventDetailsCover'; +export * from './types'; \ No newline at end of file diff --git a/src/components/EventDetailsCover/types.ts b/src/components/EventDetailsCover/types.ts new file mode 100644 index 0000000..4a8c951 --- /dev/null +++ b/src/components/EventDetailsCover/types.ts @@ -0,0 +1,15 @@ +export interface EventDetailsCoverProps { + title: string; + startDate: string; + endDate: string; + location: { + venue: string; + address: string; + city: string; + state: string; + zipCode: string; + country: string; + }; + coverImage?: string; + hideCoverImage?: boolean; +} \ No newline at end of file diff --git a/src/stories/EventDetailsCover.stories.tsx b/src/stories/EventDetailsCover.stories.tsx new file mode 100644 index 0000000..6c0f4d4 --- /dev/null +++ b/src/stories/EventDetailsCover.stories.tsx @@ -0,0 +1,37 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { EventDetailsCover } from '@/components/EventDetailsCover/EventDetailsCover'; + +const meta: Meta = { + title: 'Components/EventDetailsCover', + component: EventDetailsCover, + parameters: { + layout: 'centered', + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + title: 'Everyone no Cover At Taj NYC #1 Urban Night Party', + startDate: '2024-01-25T23:00:00', + endDate: '2024-01-26T04:00:00', + location: { + venue: 'Taj II', + address: '48 West 21st Street', + city: 'New York', + state: 'NY', + zipCode: '10010', + country: 'United States' + }, + coverImage: '/nightParty1.png' + }, +}; + +export const WithoutCoverImage: Story = { + args: { + ...Default.args, + hideCoverImage: true, + }, +}; \ No newline at end of file diff --git a/src/utils/dateFormatter.ts b/src/utils/dateFormatter.ts new file mode 100644 index 0000000..983f393 --- /dev/null +++ b/src/utils/dateFormatter.ts @@ -0,0 +1,20 @@ +export const formatEventDate = (startDate: string, endDate: string): string => { + const start = new Date(startDate); + const end = new Date(endDate); + + const options: Intl.DateTimeFormatOptions = { + month: 'long', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + hour12: true + }; + + const startFormatted = start.toLocaleDateString('en-US', options); + const endFormatted = end.toLocaleDateString('en-US', { + ...options, + month: undefined // Don't show month if it's the same day + }); + + return `${startFormatted} - ${endFormatted}`; +}; \ No newline at end of file