aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorcodetorso <[email protected]>2024-06-22 23:10:28 +0530
committercodetorso <[email protected]>2024-06-22 23:10:28 +0530
commitbecb3064c2c9cc137dbbcfdfa464c8bb71668832 (patch)
tree85e6e9875dd904f811e3fada454039ac6f47a3a9 /packages
parentimprove canvas drag and drop make sidepanel work (diff)
downloadsupermemory-becb3064c2c9cc137dbbcfdfa464c8bb71668832.tar.xz
supermemory-becb3064c2c9cc137dbbcfdfa464c8bb71668832.zip
Unreadable Canvas code, jk 😂
Diffstat (limited to 'packages')
-rw-r--r--packages/ui/components/canvas/draggableComponent.tsx2
-rw-r--r--packages/ui/shadcn/switch.tsx29
2 files changed, 30 insertions, 1 deletions
diff --git a/packages/ui/components/canvas/draggableComponent.tsx b/packages/ui/components/canvas/draggableComponent.tsx
index da3c42c7..f9531f96 100644
--- a/packages/ui/components/canvas/draggableComponent.tsx
+++ b/packages/ui/components/canvas/draggableComponent.tsx
@@ -58,7 +58,7 @@ function DraggableComponents({
onDragEnd={handleDragEnd}
onDragStart={handleDragStart}
draggable
- className={`flex gap-4 px-3 text-[#989EA4] border-2 transition ${isDragging ? "border-blue-600": "border-[#1F2428]"}`}
+ className={`flex gap-4 px-1 rounded-md text-[#989EA4] border-2 transition ${isDragging ? "border-blue-600": "border-[#1F2428]"}`}
>
<Image className="select-none" src={icon} alt={iconAlt} />
<div className="flex flex-col gap-2">
diff --git a/packages/ui/shadcn/switch.tsx b/packages/ui/shadcn/switch.tsx
new file mode 100644
index 00000000..78a67682
--- /dev/null
+++ b/packages/ui/shadcn/switch.tsx
@@ -0,0 +1,29 @@
+"use client"
+
+import * as React from "react"
+import * as SwitchPrimitives from "@radix-ui/react-switch"
+
+import { cn } from "@repo/ui/lib/utils";
+
+const Switch = React.forwardRef<
+ React.ElementRef<typeof SwitchPrimitives.Root>,
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
+>(({ className, ...props }, ref) => (
+ <SwitchPrimitives.Root
+ className={cn(
+ "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
+ className
+ )}
+ {...props}
+ ref={ref}
+ >
+ <SwitchPrimitives.Thumb
+ className={cn(
+ "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
+ )}
+ />
+ </SwitchPrimitives.Root>
+))
+Switch.displayName = SwitchPrimitives.Root.displayName
+
+export { Switch }