From 28b94a865f0aa773ac197488708350cc53bd5723 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Thu, 17 Aug 2023 15:12:33 +0100 Subject: [PATCH] perf: Create a seperate component for dependencies of BookEventForm (#10808) Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> --- .../BookEventForm/BookFormAsModal.tsx | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/packages/features/bookings/Booker/components/BookEventForm/BookFormAsModal.tsx b/packages/features/bookings/Booker/components/BookEventForm/BookFormAsModal.tsx index 8a2a71a569..a43f58eb3b 100644 --- a/packages/features/bookings/Booker/components/BookEventForm/BookFormAsModal.tsx +++ b/packages/features/bookings/Booker/components/BookEventForm/BookFormAsModal.tsx @@ -9,35 +9,42 @@ import { useBookerStore } from "../../store"; import { useEvent } from "../../utils/event"; import { BookEventForm } from "./BookEventForm"; -export function BookFormAsModal({ visible, onCancel }: { visible: boolean; onCancel: () => void }) { +const BookEventFormWrapper = ({ onCancel }: { onCancel: () => void }) => { const { t } = useLocale(); const selectedTimeslot = useBookerStore((state) => state.selectedTimeslot); const selectedDuration = useBookerStore((state) => state.selectedDuration); const { data } = useEvent(); const parsedSelectedTimeslot = dayjs(selectedTimeslot); const { timeFormat, timezone } = useTimePreferences(); + return ( + <> +

{t("confirm_your_details")}

+
+ + + {parsedSelectedTimeslot.format("LL")} {parsedSelectedTimeslot.tz(timezone).format(timeFormat)} + + + {(selectedDuration || data?.length) && ( + + {selectedDuration || data?.length} + + )} +
+ + + ); +}; +export const BookFormAsModal = ({ visible, onCancel }: { visible: boolean; onCancel: () => void }) => { return ( -

{t("confirm_your_details")}

-
- - - {parsedSelectedTimeslot.format("LL")} {parsedSelectedTimeslot.tz(timezone).format(timeFormat)} - - - {(selectedDuration || data?.length) && ( - - {selectedDuration || data?.length} - - )} -
- +
); -} +};