From 21bc4f93861a6070f319c2f8ce15a236d08fddb0 Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Fri, 11 Mar 2022 00:26:42 +0000 Subject: [PATCH] Radix UI Switch (#2075) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Radix UI Switch Making all switches consistent - using Raxix UI design instead of headless * Moving Switch Component to Monorepo * Update apps/web/components/booking/TimeOptions.tsx * Fix stripe data import Co-authored-by: Peer Richelsen Co-authored-by: Omar López Co-authored-by: Alan --- apps/web/components/booking/TimeOptions.tsx | 44 ++++++------------- .../integrations/CalendarListContainer.tsx | 3 +- .../components/webhook/WebhookDialogForm.tsx | 3 +- apps/web/pages/event-types/[type].tsx | 2 +- packages/config/tailwind-preset.js | 1 + .../web/components => packages}/ui/Switch.tsx | 4 +- packages/ui/index.tsx | 1 + 7 files changed, 22 insertions(+), 36 deletions(-) rename {apps/web/components => packages}/ui/Switch.tsx (92%) diff --git a/apps/web/components/booking/TimeOptions.tsx b/apps/web/components/booking/TimeOptions.tsx index 14947b04..ca50d265 100644 --- a/apps/web/components/booking/TimeOptions.tsx +++ b/apps/web/components/booking/TimeOptions.tsx @@ -1,9 +1,8 @@ -// TODO: replace headlessui with radix-ui -import { Switch } from "@headlessui/react"; import { FC, useEffect, useState } from "react"; import TimezoneSelect, { ITimezoneOption } from "react-timezone-select"; -import classNames from "@lib/classNames"; +import Switch from "@calcom/ui/Switch"; + import { useLocale } from "@lib/hooks/useLocale"; import { is24h, timeZone } from "../../lib/clock"; @@ -36,34 +35,17 @@ const TimeOptions: FC = ({ onToggle24hClock, onSelectTimeZone }) => { return selectedTimeZone !== "" ? (
-
{t("time_options")}
-
- - - {t("am_pm")} - - - {t("use_setting")} - - - {t("24_h")} - - +
{t("time_options")}
+
+ +
& { label: string; @@ -37,7 +37,7 @@ export default function Switch(props: SwitchProps) { {label && ( + className="cursor-pointer align-text-top text-sm font-medium text-neutral-700 ltr:ml-3 rtl:mr-3 dark:text-white"> {label} )} diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx index 308d259b..ec9a5d06 100644 --- a/packages/ui/index.tsx +++ b/packages/ui/index.tsx @@ -1,3 +1,4 @@ import * as React from "react"; export * from "./Button"; +export * from "./Switch";