diff --git a/packages/features/bookings/Booker/Booker.tsx b/packages/features/bookings/Booker/Booker.tsx index 120a800232..e1ccfd434f 100644 --- a/packages/features/bookings/Booker/Booker.tsx +++ b/packages/features/bookings/Booker/Booker.tsx @@ -64,6 +64,7 @@ const BookerComponent = ({ verifyCode, isPlatform, orgBannerUrl, + customClassNames, }: BookerProps & WrappedBookerProps) => { const { t } = useLocale(); const [bookerState, setBookerState] = useBookerStore((state) => [state.state, state.setState], shallow); @@ -268,14 +269,14 @@ const BookerComponent = ({
{!isInstantMeeting && ( @@ -339,8 +340,17 @@ const BookerComponent = ({ src={orgBannerUrl} /> )} - - + {layout !== BookerLayouts.MONTH_VIEW && !(layout === "mobile" && bookerState === "booking") && (
@@ -353,7 +363,7 @@ const BookerComponent = ({ {EventBooker} @@ -366,7 +376,18 @@ const BookerComponent = ({ {...fadeInLeft} initial="visible" className="md:border-subtle ml-[-1px] h-full flex-shrink px-5 py-3 md:border-l lg:w-[var(--booker-main-width)]"> - +
- - {!hideBranding && !isPlatform && ( { const selectedDate = useBookerStore((state) => state.selectedDate); const setSelectedTimeslot = useBookerStore((state) => state.setSelectedTimeslot); @@ -81,13 +88,17 @@ export const AvailableTimeSlots = ({ return ( <> -
+
{isLoading ? (
) : ( slotsPerDay.length > 0 && slotsPerDay.map((slots) => ( {isLoading && // Shows exact amount of days as skeleton. Array.from({ length: 1 + (extraDays ?? 0) }).map((_, i) => )} @@ -114,6 +126,8 @@ export const AvailableTimeSlots = ({ slotsPerDay.map((slots) => (
{ const { i18n } = useLocale(); const [month, selectedDate] = useBookerStore((state) => [state.month, state.selectedDate], shallow); @@ -27,6 +36,14 @@ export const DatePicker = ({ return ( { setSelectedDate(date === null ? date : date.format("YYYY-MM-DD")); diff --git a/packages/features/bookings/Booker/components/EventMeta.tsx b/packages/features/bookings/Booker/components/EventMeta.tsx index 284ae0d66b..10b37281a0 100644 --- a/packages/features/bookings/Booker/components/EventMeta.tsx +++ b/packages/features/bookings/Booker/components/EventMeta.tsx @@ -27,10 +27,16 @@ export const EventMeta = ({ event, isPending, isPlatform = true, + classNames, }: { event: useEventReturnType["data"]; isPending: useEventReturnType["isPending"]; isPlatform?: boolean; + classNames?: { + eventMetaContainer?: string; + eventMetaTitle?: string; + eventMetaTimezoneSelect?: string; + }; }) => { const { setTimezone, timeFormat, timezone } = useTimePreferences(); const selectedDuration = useBookerStore((state) => state.selectedDuration); @@ -78,7 +84,7 @@ export const EventMeta = ({ : "text-bookinghighlight"; return ( -
+
{isPending && ( @@ -92,7 +98,7 @@ export const EventMeta = ({ profile={event.profile} entity={event.entity} /> - {event?.title} + {event?.title} {event.description && (
@@ -126,7 +132,6 @@ export const EventMeta = ({ )} - "!min-h-0 p-0 w-full border-0 bg-transparent focus-within:ring-0", menu: () => "!w-64 max-w-[90vw]", diff --git a/packages/features/bookings/Booker/types.ts b/packages/features/bookings/Booker/types.ts index 80e74437d3..6d5d29955d 100644 --- a/packages/features/bookings/Booker/types.ts +++ b/packages/features/bookings/Booker/types.ts @@ -18,6 +18,11 @@ export interface BookerProps { username: string; orgBannerUrl?: string | null; + /* + all custom classnames related to booker styling go here + */ + customClassNames?: CustomClassNames; + /** * Whether is a team or org, we gather basic info from both */ @@ -125,3 +130,26 @@ export type WrappedBookerProps = WrappedBookerPropsForPlatform | WrappedBookerPr export type BookerState = "loading" | "selecting_date" | "selecting_time" | "booking"; export type BookerLayout = BookerLayouts | "mobile"; export type BookerAreas = "calendar" | "timeslots" | "main" | "meta" | "header"; + +export type CustomClassNames = { + bookerContainer?: string; + eventMetaCustomClassname?: { + eventMetaContainer?: string; + eventMetaTitle?: string; + eventMetaTimezoneSelect?: string; + }; + datePickerCustomClassname?: { + datePickerContainer?: string; + datePickerTitle?: string; + datePickerDays?: string; + datePickerDate?: string; + datePickerDatesActive?: string; + datePickerToggle?: string; + }; + availableTimeSlotsCustomClassname: { + availableTimeSlotsContainer?: string; + availableTimeSlotsTitle?: string; + availableTimeSlotsTimeFormatToggle: string; + availableTimes?: string; + }; +}; diff --git a/packages/features/bookings/components/AvailableTimes.tsx b/packages/features/bookings/components/AvailableTimes.tsx index bed85fd054..59670b12ee 100644 --- a/packages/features/bookings/components/AvailableTimes.tsx +++ b/packages/features/bookings/components/AvailableTimes.tsx @@ -36,6 +36,7 @@ type AvailableTimesProps = { className?: string; selectedSlots?: string[]; event: useEventReturnType; + customClassnames?: string; }; const SlotItem = ({ @@ -45,6 +46,7 @@ const SlotItem = ({ onTimeSelect, showAvailableSeatsCount, event, + customClassnames, }: { slot: Slots[string][number]; seatsPerTimeSlot?: number | null; @@ -52,6 +54,7 @@ const SlotItem = ({ onTimeSelect: TOnTimeSelect; showAvailableSeatsCount?: boolean | null; event: useEventReturnType; + customClassnames?: string; }) => { const { t } = useLocale(); @@ -121,8 +124,9 @@ const SlotItem = ({ data-time={slot.time} onClick={onButtonClick} className={classNames( - "min-h-9 hover:border-brand-default mb-2 flex h-auto w-full flex-grow flex-col justify-center py-2", - selectedSlots?.includes(slot.time) && "border-brand-default" + `min-h-9 hover:border-brand-default mb-2 flex h-auto w-full flex-grow flex-col justify-center py-2`, + selectedSlots?.includes(slot.time) && "border-brand-default", + `${customClassnames}` )} color="secondary">
@@ -193,6 +197,7 @@ export const AvailableTimes = ({ className, selectedSlots, event, + customClassnames, }: AvailableTimesProps) => { const { t } = useLocale(); @@ -223,6 +228,7 @@ export const AvailableTimes = ({ if (slot.away) return null; return ( { const { t, i18n } = useLocale(); const [layout] = useBookerStore((state) => [state.layout], shallow); @@ -28,20 +34,31 @@ export const AvailableTimesHeader = ({ const isToday = dayjs().isSame(date, "day"); return ( -
+
- + {nameOfDay(i18n.language, Number(date.format("d")), "short")} {date.format("DD")} {availableMonth && `, ${availableMonth}`} @@ -50,7 +67,7 @@ export const AvailableTimesHeader = ({ {showTimeFormatToggle && (
- +
)}
diff --git a/packages/features/bookings/components/TimeFormatToggle.tsx b/packages/features/bookings/components/TimeFormatToggle.tsx index 20b38bec96..330e4dce89 100644 --- a/packages/features/bookings/components/TimeFormatToggle.tsx +++ b/packages/features/bookings/components/TimeFormatToggle.tsx @@ -4,13 +4,14 @@ import { ToggleGroup } from "@calcom/ui"; import { useTimePreferences } from "../lib"; -export const TimeFormatToggle = () => { +export const TimeFormatToggle = ({ customClassname }: { customClassname?: string }) => { const timeFormat = useTimePreferences((state) => state.timeFormat); const setTimeFormat = useTimePreferences((state) => state.setTimeFormat); const { t } = useLocale(); return ( { if (newFormat && newFormat !== timeFormat) setTimeFormat(newFormat as TimeFormat); }} diff --git a/packages/features/calendars/DatePicker.tsx b/packages/features/calendars/DatePicker.tsx index 24ad9a4cd0..ac2388e5a7 100644 --- a/packages/features/calendars/DatePicker.tsx +++ b/packages/features/calendars/DatePicker.tsx @@ -59,12 +59,17 @@ export const Day = ({ disabled, away, emoji, + customClassname, ...props }: JSX.IntrinsicElements["button"] & { active: boolean; date: Dayjs; away?: boolean; emoji?: string | null; + customClassname?: { + dayContainer?: string; + dayActive?: string; + }; }) => { const { t } = useLocale(); const enabledDateButtonEmbedStyles = useEmbedStyles("enabledDateButton"); @@ -79,8 +84,12 @@ export const Day = ({ active ? "bg-brand-default text-brand" : !disabled - ? " hover:border-brand-default text-emphasis bg-emphasis" - : "text-muted" + ? `${ + !customClassname?.dayActive + ? "hover:border-brand-default text-emphasis bg-emphasis" + : `hover:border-brand-default ${customClassname.dayActive}` + }` + : `${customClassname ? "" : " text-mute"}` )} data-testid="day" data-disabled={disabled} @@ -131,6 +140,7 @@ const Days = ({ nextMonthButton, eventSlug, slots, + customClassname, ...props }: Omit & { DayComponent?: React.FC>; @@ -138,6 +148,10 @@ const Days = ({ weekStart: number; month: string | null; nextMonthButton: () => void; + customClassname?: { + datePickerDate?: string; + datePickerDateActive?: string; + }; }) => { // Create placeholder elements for empty days in first week const weekdayOfFirst = browsingDate.date(1).day(); @@ -244,6 +258,10 @@ const Days = ({ ) : ( { props.onChange(day); @@ -271,8 +289,18 @@ const DatePicker = ({ selected, onMonthChange, slots, + customClassNames, ...passThroughProps -}: DatePickerProps & Partial>) => { +}: DatePickerProps & + Partial> & { + customClassNames?: { + datePickerTitle?: string; + datePickerDays?: string; + datePickersDates?: string; + datePickerDatesActive?: string; + datePickerToggle?: string; + }; + }) => { const browsingDate = passThroughProps.browsingDate || dayjs().startOf("month"); const { i18n } = useLocale(); @@ -293,8 +321,13 @@ const DatePicker = ({ {browsingDate ? ( <> - {month}{" "} - {browsingDate.format("YYYY")} + + {month} + {" "} + + {browsingDate.format("YYYY")} + ) : ( @@ -304,9 +337,10 @@ const DatePicker = ({
{weekdayNames(locale, weekStart, "short").map((weekDay) => ( -
+
{weekDay}
))}
({ dayRanges?: string; timeRangeField?: string; labelAndSwitchContainer?: string; + scheduleContainer?: string; }; }) => { const { watch, setValue } = useFormContext(); diff --git a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx index e9b55e78d4..6c36a10d83 100644 --- a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx +++ b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx @@ -34,6 +34,29 @@ import { usePublicEvent } from "../hooks/usePublicEvent"; import { useSlots } from "../hooks/useSlots"; import { AtomsWrapper } from "../src/components/atoms-wrapper"; +export type CustomClassNames = { + bookerContainer?: string; + eventMetaCustomClassname?: { + eventMetaContainer?: string; + eventMetaTitle?: string; + eventMetaTimezoneSelect?: string; + }; + datePickerCustomClassname?: { + datePickerContainer?: string; + datePickerTitle?: string; + datePickerDays?: string; + datePickerDate?: string; + datePickerDatesActive?: string; + datePickerToggle?: string; + }; + availableTimeSlotsCustomClassname?: { + availableTimeSlotsContainer?: string; + availableTimeSlotsTitle?: string; + availableTimeSlotsTimeFormatToggle?: string; + availableTimes?: string; + }; +}; + type BookerPlatformWrapperAtomProps = Omit & { rescheduleUid?: string; bookingUid?: string; @@ -232,6 +255,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) => return ( { const router = useRouter(); diff --git a/packages/ui/components/form/timezone-select/TimezoneSelect.tsx b/packages/ui/components/form/timezone-select/TimezoneSelect.tsx index 433c1e7c94..c243efc9e1 100644 --- a/packages/ui/components/form/timezone-select/TimezoneSelect.tsx +++ b/packages/ui/components/form/timezone-select/TimezoneSelect.tsx @@ -13,7 +13,10 @@ export interface ICity { timezone: string; } -export type TimezoneSelectProps = SelectProps & { variant?: "default" | "minimal" }; +export type TimezoneSelectProps = SelectProps & { + variant?: "default" | "minimal"; + timezoneSelectCustomClassname?: string; +}; export function TimezoneSelect(props: TimezoneSelectProps) { const { data, isPending } = trpc.viewer.timezones.cityTimezones.useQuery(undefined, { trpc: { context: { skipBatch: true } }, @@ -26,10 +29,12 @@ export type TimezoneSelectComponentProps = SelectProps & { variant?: "default" | "minimal"; isPending: boolean; data: ICity[] | undefined; + timezoneSelectCustomClassname?: string; }; export function TimezoneSelectComponent({ className, classNames: timezoneClassNames, + timezoneSelectCustomClassname, components, variant = "default", data, @@ -51,7 +56,7 @@ export function TimezoneSelectComponent({ return ( {children}; }; -export const ToggleGroup = ({ options, onValueChange, isFullWidth, ...props }: ToggleGroupProps) => { +export const ToggleGroup = ({ + options, + onValueChange, + isFullWidth, + customClassnames, + ...props +}: ToggleGroupProps & { customClassnames?: string }) => { return ( <> {options.map((option) => (