* [WIP] New design and components for onboarding page * saving work in progress * new fonts * [WIP] new onboarding page, initial page, components * WIP calendar connect * WIP availability new design * WIP onboarding page * WIP onboarding, working new availability form * WIP AvailabilitySchedule componente v2 * WIP availability with defaultSchedule * User profile view * Relocate new onboarding/getting-started page components * Steps test for onboarding v2 * Remove logs and unused code * remove any as types * Adding translations * Fixes translation text and css for step 4 * Deprecation note for old-getting-started * Added defaul events and refetch user query when finishing getting-started * Fix button text translation * Undo schedule v1 changes * Fix calendar switches state * Add cookie to save return-to when connecting calendar * Change useTranslation for useLocale instead * Change test to work with data-testid instead of hardcoded plain text due to translation * Fix skeleton containers for calendars * Style fixes * fix styles to match v2 * Fix styles and props types to match v2 design * Bugfix/router and console errors (#4206) * The loading={boolean} parameter is required, so this must be <Button /> * Fixes duplicate key error * Use zod and router.query.step directly to power state machine * use ul>li & divide for borders * Update apps/web/components/getting-started/steps-views/ConnectCalendars.tsx Co-authored-by: alannnc <[email protected]> * Linting * Deprecation notices and type fixes * Update CreateEventsOnCalendarSelect.tsx * Type fixes Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: zomars <[email protected]>
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { useId } from "@radix-ui/react-id";
|
|
import * as Label from "@radix-ui/react-label";
|
|
import * as PrimitiveSwitch from "@radix-ui/react-switch";
|
|
import React from "react";
|
|
|
|
import classNames from "@calcom/lib/classNames";
|
|
|
|
const Switch = (
|
|
props: React.ComponentProps<typeof PrimitiveSwitch.Root> & {
|
|
label?: string;
|
|
thumbProps?: {
|
|
className?: string;
|
|
};
|
|
}
|
|
) => {
|
|
const { label, ...primitiveProps } = props;
|
|
const id = useId();
|
|
|
|
return (
|
|
<div className="flex h-auto w-auto flex-row items-center">
|
|
<PrimitiveSwitch.Root
|
|
className={classNames(
|
|
props.checked ? "bg-gray-900" : "bg-gray-200 hover:bg-gray-300",
|
|
"focus:ring-brand-800 h-6 w-10 rounded-full shadow-none",
|
|
props.className
|
|
)}
|
|
{...primitiveProps}>
|
|
<PrimitiveSwitch.Thumb
|
|
id={id}
|
|
// Since we dont support global dark mode - we have to style dark mode components specifically on the instance for now
|
|
// TODO: Remove once we support global dark mode
|
|
className={classNames(
|
|
"block h-[18px] w-[18px] rounded-full bg-white",
|
|
"translate-x-[4px] transition delay-100 will-change-transform",
|
|
"[&[data-state='checked']]:translate-x-[18px]",
|
|
props.checked && "shadow-inner",
|
|
props.thumbProps?.className
|
|
)}
|
|
/>
|
|
</PrimitiveSwitch.Root>
|
|
{label && (
|
|
<Label.Root
|
|
htmlFor={id}
|
|
className="ml-2 cursor-pointer align-text-top text-sm font-medium text-neutral-700 ltr:ml-3 rtl:mr-3 dark:text-white">
|
|
{label}
|
|
</Label.Root>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Switch;
|