Files
cal.diy/packages/ui/components/calendar-switch/CalendarSwitch.tsx
T
0b03bcb90e feat: CalendarSettings atom (#16120)
* dumb components for calendar settings

* shadcn switch

* update exports

* update packages

* add calendar settings atom to examples app

* init calendar settings atom

* refactors

* fix import path

* export type for calendar switch props

* invalidate queries on deleting calendar credentials

* replace calendars list with calendar settings wrapper

* cleanup

* update styling

* refactors

* cleanup

* fix: missing key prop CalendarSettingsPlatformWrapper

* Label as client components

* Address client component build errors

* Move QueryCell out of packages/lib

* PR feedback

* more feedback

---------

Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Morgan <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
2024-08-13 21:51:29 +05:30

44 lines
1.2 KiB
TypeScript

"use client";
import type { ReactNode } from "react";
import { type ICalendarSwitchProps } from "@calcom/features/calendars/CalendarSwitch";
import { classNames } from "@calcom/lib";
import { Icon } from "@calcom/ui";
export function CalendarSwitchComponent(
props: ICalendarSwitchProps & {
isLoading: boolean;
children: ReactNode;
translations?: {
spanText?: string;
};
}
) {
const {
externalId,
name,
isLoading,
translations = {
spanText: "Adding events to",
},
children,
} = props;
return (
<div className={classNames("my-2 flex flex-row items-center")}>
<div className="flex pl-2">{children}</div>
<label className="ml-3 text-sm font-medium leading-5" htmlFor={externalId}>
{name}
</label>
{!!props.destination && (
<span className="bg-subtle text-default ml-8 inline-flex items-center gap-1 rounded-md px-2 py-1 text-sm font-normal sm:ml-4">
<Icon name="arrow-left" className="h-4 w-4" />
{translations.spanText}
</span>
)}
{isLoading && <Icon name="rotate-cw" className="text-muted h-4 w-4 animate-spin ltr:ml-1 rtl:mr-1" />}
</div>
);
}