One Calendar is a privacy-first calendar web app built with Next.js. It has modern security features, including e2ee, password-protected sharing, and self-destructing share links ๐Ÿ“… calendar.xyehr.cn
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

ui: update ui library

authored by

Evan Huang and committed by
GitHub
06773715 f728b5b5

+14 -12
+14 -12
components/ui/switch.tsx
··· 1 - "use client"; 1 + "use client" 2 2 3 - import * as SwitchPrimitive from "@radix-ui/react-switch"; 4 - import * as React from "react"; 3 + import * as React from "react" 4 + import { Switch as SwitchPrimitive } from "radix-ui" 5 5 6 - import { cn } from "@/lib/utils"; 6 + import { cn } from "@/lib/utils" 7 7 8 8 function Switch({ 9 9 className, 10 + size = "default", 10 11 ...props 11 - }: React.ComponentProps<typeof SwitchPrimitive.Root>) { 12 + }: React.ComponentProps<typeof SwitchPrimitive.Root> & { 13 + size?: "sm" | "default" 14 + }) { 12 15 return ( 13 16 <SwitchPrimitive.Root 14 17 data-slot="switch" 18 + data-size={size} 15 19 className={cn( 16 - "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", 17 - className, 20 + "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50", 21 + className 18 22 )} 19 23 {...props} 20 24 > 21 25 <SwitchPrimitive.Thumb 22 26 data-slot="switch-thumb" 23 - className={cn( 24 - "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0", 25 - )} 27 + className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground" 26 28 /> 27 29 </SwitchPrimitive.Root> 28 - ); 30 + ) 29 31 } 30 32 31 - export { Switch }; 33 + export { Switch }