feat: add classNames prop to Booker atom for passing external styles (#14270)

* add classnames prop to pass external styles

* fix import

* add comments

* ignore this commit: tinkering with styling

* update typings

* mostly creating props and passing it down to child components

* remove unnecessary comment

* merge conflicts

* fixup

* fixup

* fix conflicts

* fix merge conflicts

* fix merge conflicts

* fix failing type checks

* type checks fix

* add custom classnames to booker props

* update typings

* pass in props down wherever necessary

* fixup

* still passing down around some more props

* addressing pr feedback

* final fixes

* address feedback

* fixup! address feedback

* fixup! fixup! address feedback

* fixup! fixup! fixup! address feedback

---------

Co-authored-by: Morgan <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-04-12 21:49:01 +00:00
1 parent 18093824d8
commit c467167e91
14 files changed
+232 -39

No files matched your search

+30 -10
View File
@@ -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 = ({
<div
ref={animationScope}
className={classNames(
// Sets booker size css variables for the size of all the columns.
...getBookerSizeClassNames(layout, bookerState, hideEventTypeDetails),
"bg-default dark:bg-muted grid max-w-full items-start dark:[color-scheme:dark] sm:transition-[width] sm:duration-300 sm:motion-reduce:transition-none md:flex-row",
`bg-default dark:bg-muted grid max-w-full items-start dark:[color-scheme:dark] sm:transition-[width] sm:duration-300 sm:motion-reduce:transition-none md:flex-row`,
// We remove border only when the content covers entire viewport. Because in embed, it can almost never be the case that it covers entire viewport, we show the border there
(layout === BookerLayouts.MONTH_VIEW || isEmbed) && "border-subtle rounded-md border",
(layout === BookerLayouts.MONTH_VIEW || isEmbed) && "border-subtle rounded-md",
!isEmbed && "sm:transition-[width] sm:duration-300",
isEmbed && layout === BookerLayouts.MONTH_VIEW && "border-booker sm:border-booker-width",
!isEmbed && layout === BookerLayouts.MONTH_VIEW && "border-subtle"
!isEmbed && layout === BookerLayouts.MONTH_VIEW && `border-subtle`,
`${customClassNames?.bookerContainer}`
)}>
<AnimatePresence>
{!isInstantMeeting && (
@@ -339,8 +340,17 @@ const BookerComponent = ({
src={orgBannerUrl}
/>
)}
<EventMeta event={event.data} isPending={event.isPending} isPlatform={isPlatform} />
<EventMeta
classNames={{
eventMetaContainer: customClassNames?.eventMetaCustomClassname?.eventMetaContainer,
eventMetaTitle: customClassNames?.eventMetaCustomClassname?.eventMetaTitle,
eventMetaTimezoneSelect:
customClassNames?.eventMetaCustomClassname?.eventMetaTimezoneSelect,
}}
event={event.data}
isPending={event.isPending}
isPlatform={isPlatform}
/>
{layout !== BookerLayouts.MONTH_VIEW &&
!(layout === "mobile" && bookerState === "booking") && (
<div className="mt-auto px-5 py-3 ">
@@ -353,7 +363,7 @@ const BookerComponent = ({
<BookerSection
key="book-event-form"
area="main"
className="border-subtle sticky top-0 ml-[-1px] h-full p-6 md:w-[var(--booker-main-width)] md:border-l"
className="sticky top-0 ml-[-1px] h-full p-6 md:w-[var(--booker-main-width)] md:border-l"
{...fadeInLeft}
visible={bookerState === "booking" && !shouldShowFormInDialog}>
{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)]">
<DatePicker event={event} schedule={schedule} />
<DatePicker
classNames={{
datePickerContainer: customClassNames?.datePickerCustomClassname?.datePickerContainer,
datePickerTitle: customClassNames?.datePickerCustomClassname?.datePickerTitle,
datePickerDays: customClassNames?.datePickerCustomClassname?.datePickerDays,
datePickerDate: customClassNames?.datePickerCustomClassname?.datePickerDate,
datePickerDatesActive: customClassNames?.datePickerCustomClassname?.datePickerDatesActive,
datePickerToggle: customClassNames?.datePickerCustomClassname?.datePickerToggle,
}}
event={event}
schedule={schedule}
/>
</BookerSection>
<BookerSection
@@ -398,6 +419,7 @@ const BookerComponent = ({
ref={timeslotsRef}
{...fadeInLeft}>
<AvailableTimeSlots
customClassnames={customClassNames?.availableTimeSlotsCustomClassname}
extraDays={extraDays}
limitHeight={layout === BookerLayouts.MONTH_VIEW}
schedule={schedule?.data}
@@ -409,7 +431,6 @@ const BookerComponent = ({
</BookerSection>
</AnimatePresence>
</div>
<HavingTroubleFindingTime
visible={bookerState !== "booking" && layout === BookerLayouts.MONTH_VIEW && !isMobile}
dayCount={dayCount}
@@ -418,7 +439,6 @@ const BookerComponent = ({
setDayCount(null);
}}
/>
{!hideBranding && !isPlatform && (
<m.span
key="logo"
@@ -20,6 +20,12 @@ type AvailableTimeSlotsProps = {
seatsPerTimeSlot?: number | null;
showAvailableSeatsCount?: boolean | null;
event: useEventReturnType;
customClassnames?: {
availableTimeSlotsContainer?: string;
availableTimeSlotsTitle?: string;
availableTimeSlotsTimeFormatToggle: string;
availableTimes?: string;
};
};
/**
@@ -37,6 +43,7 @@ export const AvailableTimeSlots = ({
schedule,
isLoading,
event,
customClassnames,
}: AvailableTimeSlotsProps) => {
const selectedDate = useBookerStore((state) => state.selectedDate);
const setSelectedTimeslot = useBookerStore((state) => state.setSelectedTimeslot);
@@ -81,13 +88,17 @@ export const AvailableTimeSlots = ({
return (
<>
<div className="flex">
<div className={classNames(`flex`, `${customClassnames?.availableTimeSlotsContainer}`)}>
{isLoading ? (
<div className="mb-3 h-8" />
) : (
slotsPerDay.length > 0 &&
slotsPerDay.map((slots) => (
<AvailableTimesHeader
customClassnames={{
availableTimeSlotTitle: customClassnames?.availableTimeSlotsTitle,
availableTimeSlotTimeFormatToggle: customClassnames?.availableTimeSlotsTimeFormatToggle,
}}
key={slots.date}
date={dayjs(slots.date)}
showTimeFormatToggle={!isColumnView}
@@ -105,7 +116,8 @@ export const AvailableTimeSlots = ({
ref={containerRef}
className={classNames(
limitHeight && "scroll-bar flex-grow overflow-auto md:h-[400px]",
!limitHeight && "flex h-full w-full flex-row gap-4"
!limitHeight && "flex h-full w-full flex-row gap-4",
`${customClassnames?.availableTimeSlotsContainer}`
)}>
{isLoading && // Shows exact amount of days as skeleton.
Array.from({ length: 1 + (extraDays ?? 0) }).map((_, i) => <AvailableTimesSkeleton key={i} />)}
@@ -114,6 +126,8 @@ export const AvailableTimeSlots = ({
slotsPerDay.map((slots) => (
<div key={slots.date} className="scroll-bar h-full w-full overflow-y-auto overflow-x-hidden">
<AvailableTimes
className={customClassnames?.availableTimeSlotsContainer}
customClassnames={customClassnames?.availableTimes}
showTimeFormatToggle={!isColumnView}
onTimeSelect={onTimeSelect}
slots={slots.slots}
@@ -13,9 +13,18 @@ import type { useEventReturnType, useScheduleForEventReturnType } from "../utils
export const DatePicker = ({
event,
schedule,
classNames,
}: {
event: useEventReturnType;
schedule: useScheduleForEventReturnType;
classNames?: {
datePickerContainer?: string;
datePickerTitle?: string;
datePickerDays?: string;
datePickerDate?: string;
datePickerDatesActive?: string;
datePickerToggle?: string;
};
}) => {
const { i18n } = useLocale();
const [month, selectedDate] = useBookerStore((state) => [state.month, state.selectedDate], shallow);
@@ -27,6 +36,14 @@ export const DatePicker = ({
return (
<DatePickerComponent
customClassNames={{
datePickerTitle: classNames?.datePickerTitle,
datePickerDays: classNames?.datePickerDays,
datePickersDates: classNames?.datePickerDate,
datePickerDatesActive: classNames?.datePickerDatesActive,
datePickerToggle: classNames?.datePickerToggle,
}}
className={classNames?.datePickerContainer}
isPending={schedule.isPending}
onChange={(date: Dayjs | null) => {
setSelectedDate(date === null ? date : date.format("YYYY-MM-DD"));
@@ -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 (
<div className="relative z-10 p-6" data-testid="event-meta">
<div className={`${classNames?.eventMetaContainer} relative z-10 p-6`} data-testid="event-meta">
{isPending && (
<m.div {...fadeInUp} initial="visible" layout>
<EventMetaSkeleton />
@@ -92,7 +98,7 @@ export const EventMeta = ({
profile={event.profile}
entity={event.entity}
/>
<EventTitle className="my-2">{event?.title}</EventTitle>
<EventTitle className={`${classNames?.eventMetaTitle} my-2`}>{event?.title}</EventTitle>
{event.description && (
<EventMetaBlock contentClassName="mb-8 break-words max-w-full max-h-[180px] scroll-bar pr-4">
<div dangerouslySetInnerHTML={{ __html: event.description }} />
@@ -126,7 +132,6 @@ export const EventMeta = ({
</EventMetaBlock>
)}
<EventDetails event={event} />
<EventMetaBlock
className="cursor-pointer [&_.current-timezone:before]:focus-within:opacity-100 [&_.current-timezone:before]:hover:opacity-100"
contentClassName="relative max-w-[90%]"
@@ -140,6 +145,7 @@ export const EventMeta = ({
}`}>
<TimezoneSelect
menuPosition="fixed"
timezoneSelectCustomClassname={classNames?.eventMetaTimezoneSelect}
classNames={{
control: () => "!min-h-0 p-0 w-full border-0 bg-transparent focus-within:ring-0",
menu: () => "!w-64 max-w-[90vw]",
@@ -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;
};
};
@@ -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">
<div className="flex items-center gap-2">
@@ -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 (
<SlotItem
customClassnames={customClassnames}
key={slot.time}
onTimeSelect={onTimeSelect}
slot={slot}
@@ -2,7 +2,7 @@ import { shallow } from "zustand/shallow";
import type { Dayjs } from "@calcom/dayjs";
import dayjs from "@calcom/dayjs";
import { classNames } from "@calcom/lib";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { nameOfDay } from "@calcom/lib/weekday";
import { BookerLayouts } from "@calcom/prisma/zod-utils";
@@ -14,12 +14,18 @@ type AvailableTimesHeaderProps = {
date: Dayjs;
showTimeFormatToggle?: boolean;
availableMonth?: string | undefined;
customClassnames?: {
availableTimeSlotContainer?: string;
availableTimeSlotTitle?: string;
availableTimeSlotTimeFormatToggle?: string;
};
};
export const AvailableTimesHeader = ({
date,
showTimeFormatToggle = true,
availableMonth,
customClassnames,
}: AvailableTimesHeaderProps) => {
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 (
<header className="bg-default before:bg-default dark:bg-muted dark:before:bg-muted mb-3 flex w-full flex-row items-center font-medium">
<header
className={classNames(
`dark:bg-muted dark:before:bg-muted mb-3 flex w-full flex-row items-center font-medium`,
"bg-default before:bg-default",
customClassnames?.availableTimeSlotContainer
)}>
<span
className={classNames(
isColumnView && "w-full text-center",
isColumnView ? "text-subtle text-xs uppercase" : "text-emphasis font-semibold"
)}>
<span className={classNames(isToday && "!text-default")}>
<span
className={classNames(
isToday && !customClassnames?.availableTimeSlotTitle && "!text-default",
customClassnames?.availableTimeSlotTitle
)}>
{nameOfDay(i18n.language, Number(date.format("d")), "short")}
</span>
<span
className={classNames(
isColumnView && isToday && "bg-brand-default text-brand ml-2",
"inline-flex items-center justify-center rounded-3xl px-1 pt-0.5 font-medium",
isMonthView ? "text-default text-sm" : "text-xs"
isMonthView
? `text-default text-sm ${customClassnames?.availableTimeSlotTitle}`
: `text-xs ${customClassnames?.availableTimeSlotTitle}`
)}>
{date.format("DD")}
{availableMonth && `, ${availableMonth}`}
@@ -50,7 +67,7 @@ export const AvailableTimesHeader = ({
{showTimeFormatToggle && (
<div className="ml-auto rtl:mr-auto">
<TimeFormatToggle />
<TimeFormatToggle customClassname={customClassnames?.availableTimeSlotTimeFormatToggle} />
</div>
)}
</header>
@@ -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 (
<ToggleGroup
customClassnames={customClassname}
onValueChange={(newFormat) => {
if (newFormat && newFormat !== timeFormat) setTimeFormat(newFormat as TimeFormat);
}}
+55 -9
View File
@@ -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<DatePickerProps, "locale" | "className" | "weekStart"> & {
DayComponent?: React.FC<React.ComponentProps<typeof Day>>;
@@ -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 = ({
</button>
) : (
<DayComponent
customClassname={{
dayContainer: customClassname?.datePickerDate,
dayActive: customClassname?.datePickerDateActive,
}}
date={day}
onClick={() => {
props.onChange(day);
@@ -271,8 +289,18 @@ const DatePicker = ({
selected,
onMonthChange,
slots,
customClassNames,
...passThroughProps
}: DatePickerProps & Partial<React.ComponentProps<typeof Days>>) => {
}: DatePickerProps &
Partial<React.ComponentProps<typeof Days>> & {
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 = ({
<span className="text-default w-1/2 text-base">
{browsingDate ? (
<>
<strong className="text-emphasis font-semibold">{month}</strong>{" "}
<span className="text-subtle font-medium">{browsingDate.format("YYYY")}</span>
<strong
className={classNames(`text-emphasis font-semibold`, customClassNames?.datePickerTitle)}>
{month}
</strong>{" "}
<span className={classNames(`text-subtle font-medium`, customClassNames?.datePickerTitle)}>
{browsingDate.format("YYYY")}
</span>
</>
) : (
<SkeletonText className="h-8 w-24" />
@@ -304,9 +337,10 @@ const DatePicker = ({
<div className="flex">
<Button
className={classNames(
"group p-1 opacity-70 hover:opacity-100 rtl:rotate-180",
`group p-1 opacity-70 hover:opacity-100 rtl:rotate-180`,
!browsingDate.isAfter(dayjs()) &&
"disabled:text-bookinglighter hover:bg-background hover:opacity-70"
`disabled:text-bookinglighter hover:bg-background hover:opacity-70`,
customClassNames?.datePickerToggle
)}
onClick={() => changeMonth(-1)}
disabled={!browsingDate.isAfter(dayjs())}
@@ -316,7 +350,10 @@ const DatePicker = ({
StartIcon="chevron-left"
/>
<Button
className="group p-1 opacity-70 hover:opacity-100 rtl:rotate-180"
className={classNames(
`group p-1 opacity-70 hover:opacity-100 rtl:rotate-180`,
`${customClassNames?.datePickerToggle}`
)}
onClick={() => changeMonth(+1)}
data-testid="incrementMonth"
color="minimal"
@@ -328,13 +365,22 @@ const DatePicker = ({
</div>
<div className="border-subtle mb-2 grid grid-cols-7 gap-4 border-b border-t text-center md:mb-0 md:border-0">
{weekdayNames(locale, weekStart, "short").map((weekDay) => (
<div key={weekDay} className="text-emphasis my-4 text-xs font-medium uppercase tracking-widest">
<div
key={weekDay}
className={classNames(
`text-emphasis my-4 text-xs font-medium uppercase tracking-widest`,
customClassNames?.datePickerDays
)}>
{weekDay}
</div>
))}
</div>
<div className="relative grid grid-cols-7 grid-rows-6 gap-1 text-center">
<Days
customClassname={{
datePickerDate: customClassNames?.datePickersDates,
datePickerDateActive: customClassNames?.datePickerDatesActive,
}}
weekStart={weekStart}
selected={selected}
{...passThroughProps}
@@ -26,7 +26,6 @@ import {
Dropdown,
DropdownMenuContent,
DropdownMenuTrigger,
Icon,
Select,
SkeletonText,
Switch,
@@ -66,6 +65,7 @@ export const ScheduleDay = <TFieldValues extends FieldValues>({
dayRanges?: string;
timeRangeField?: string;
labelAndSwitchContainer?: string;
scheduleContainer?: string;
};
}) => {
const { watch, setValue } = useFormContext();
@@ -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<BookerProps, "entity"> & {
rescheduleUid?: string;
bookingUid?: string;
@@ -232,6 +255,7 @@ export const BookerPlatformWrapper = (props: BookerPlatformWrapperAtomProps) =>
return (
<AtomsWrapper>
<BookerComponent
customClassNames={props.customClassNames}
eventSlug={props.eventSlug}
username={props.username}
entity={
@@ -21,7 +21,9 @@ import { DEFAULT_LIGHT_BRAND_COLOR, DEFAULT_DARK_BRAND_COLOR } from "@calcom/lib
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
import { BookerLayouts } from "@calcom/prisma/zod-utils";
type BookerWebWrapperAtomProps = BookerProps;
import type { CustomClassNames } from "./BookerPlatformWrapper";
type BookerWebWrapperAtomProps = BookerProps & { customClassNames?: CustomClassNames };
export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
const router = useRouter();
@@ -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 (
<BaseSelect
value={value}
className={className}
className={`${className} ${timezoneSelectCustomClassname}`}
isLoading={isPending}
isDisabled={isPending}
{...reactSelectProps}
@@ -32,7 +32,13 @@ const OptionalTooltipWrapper = ({
return <>{children}</>;
};
export const ToggleGroup = ({ options, onValueChange, isFullWidth, ...props }: ToggleGroupProps) => {
export const ToggleGroup = ({
options,
onValueChange,
isFullWidth,
customClassnames,
...props
}: ToggleGroupProps & { customClassnames?: string }) => {
return (
<>
<RadixToggleGroup.Root
@@ -40,9 +46,10 @@ export const ToggleGroup = ({ options, onValueChange, isFullWidth, ...props }: T
{...props}
onValueChange={onValueChange}
className={classNames(
"min-h-9 border-default bg-default relative inline-flex gap-0.5 rounded-md border p-1 rtl:flex-row-reverse",
`min-h-9 border-default bg-default relative inline-flex gap-0.5 rounded-md border p-1 rtl:flex-row-reverse`,
props.className,
isFullWidth && "w-full"
isFullWidth && "w-full",
customClassnames
)}>
{options.map((option) => (
<OptionalTooltipWrapper key={option.value} tooltipText={option.tooltip}>