From bac618d15daa2f4a6fb121cf4b81d9febc8278b2 Mon Sep 17 00:00:00 2001 From: jeffplays2005 Date: Sun, 27 Oct 2024 22:23:26 +1300 Subject: [PATCH] Create variant for EventPreview * Both regular and admin card * Regular is a thicker padding * Admin is a smaller padding --- .../AdminEventView/AdminAllEvents/AdminAllEvents.tsx | 6 ++++-- .../generic/Event/EventPreview/EventPreview.tsx | 11 ++++++++--- client/src/components/generic/Event/EventUtils.ts | 11 ++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/client/src/components/composite/Admin/AdminEventView/AdminAllEvents/AdminAllEvents.tsx b/client/src/components/composite/Admin/AdminEventView/AdminAllEvents/AdminAllEvents.tsx index 3dabbbe9..a3484dfe 100644 --- a/client/src/components/composite/Admin/AdminEventView/AdminAllEvents/AdminAllEvents.tsx +++ b/client/src/components/composite/Admin/AdminEventView/AdminAllEvents/AdminAllEvents.tsx @@ -200,7 +200,8 @@ const AdminAllEvents = ({ return EventRenderingUtils.previewTransformer( event, eventSelectionHandler, - "edit event" + "edit event", + "admin" ) }) || [] @@ -209,7 +210,8 @@ const AdminAllEvents = ({ return EventRenderingUtils.previewTransformer( event, eventSelectionHandler, - "edit event" + "edit event", + "admin" ) }) || [] diff --git a/client/src/components/generic/Event/EventPreview/EventPreview.tsx b/client/src/components/generic/Event/EventPreview/EventPreview.tsx index 333518f2..33094fdb 100644 --- a/client/src/components/generic/Event/EventPreview/EventPreview.tsx +++ b/client/src/components/generic/Event/EventPreview/EventPreview.tsx @@ -1,7 +1,7 @@ // 4 props: 3 string, 1 image import Image from "next/image" import Arrow from "@/assets/icons/rightarrow.svg" - +export type EventCardPreviewVariant = "regular" | "admin" /** * The interface (props) associated with {@link EventsCardPreview} */ @@ -37,6 +37,10 @@ export interface IEventsCardPreview { title: string viewButtonText?: string + /** + * The variant of the card to render + */ + variant?: EventCardPreviewVariant } type ViewButtonProps = { @@ -71,13 +75,14 @@ const EventsCardPreview = ({ image = "", signUpOpenDate, isPastEvent, - viewButtonText = "view more" + viewButtonText = "view more", + variant = "regular" }: IEventsCardPreview) => { return (
void, - buttonText?: string + buttonText?: string, + variant?: EventCardPreviewVariant = "default" ): IEventsCardPreview => { let eventStartDate @@ -116,7 +120,8 @@ export const EventRenderingUtils = { onClick: () => { eventSetter(event.id) }, - viewButtonText: buttonText + viewButtonText: buttonText, + variant } } }