From 937ec499e3ac6dacce3d61efc363d28765c969ed Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 02:10:53 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- apps/engineering/app/layout.tsx | 6 +- .../design/components/id.valueTruncate.tsx | 14 +-- .../design/components/tooltip.onHover.tsx | 95 +++++++++++------- internal/ui/package.json | 1 - internal/ui/src/components/id.tsx | 98 ++++++++++--------- internal/ui/src/components/tooltip.tsx | 3 +- 6 files changed, 120 insertions(+), 97 deletions(-) diff --git a/apps/engineering/app/layout.tsx b/apps/engineering/app/layout.tsx index 508b8a32f..567c63a1a 100644 --- a/apps/engineering/app/layout.tsx +++ b/apps/engineering/app/layout.tsx @@ -4,8 +4,8 @@ import { GeistSans } from "geist/font/sans"; import type { ReactNode } from "react"; -import "./global.css"; import { TooltipProvider } from "@unkey/ui/src/components/tooltip"; +import "./global.css"; export default function Layout({ children }: { children: ReactNode }) { return ( @@ -15,7 +15,9 @@ export default function Layout({ children }: { children: ReactNode }) { suppressHydrationWarning > - {children} + + {children} + ); diff --git a/apps/engineering/content/design/components/id.valueTruncate.tsx b/apps/engineering/content/design/components/id.valueTruncate.tsx index 980583141..52c2a3e5a 100644 --- a/apps/engineering/content/design/components/id.valueTruncate.tsx +++ b/apps/engineering/content/design/components/id.valueTruncate.tsx @@ -4,11 +4,11 @@ import { Row } from "@/app/components/row"; import { Id } from "@unkey/ui"; export const ValueTruncateExample: React.FC = () => ( - - - - - - - + + + + + + + ); diff --git a/apps/engineering/content/design/components/tooltip.onHover.tsx b/apps/engineering/content/design/components/tooltip.onHover.tsx index b19f5087a..0f01ebe73 100644 --- a/apps/engineering/content/design/components/tooltip.onHover.tsx +++ b/apps/engineering/content/design/components/tooltip.onHover.tsx @@ -2,44 +2,63 @@ import { RenderComponentWithSnippet } from "@/app/components/render"; import { Row } from "@/app/components/row"; -import { Tooltip, TooltipContent, TooltipTrigger } from "@unkey/ui" +import { Tooltip, TooltipContent, TooltipTrigger } from "@unkey/ui"; import { InfoIcon } from "lucide-react"; export const OnHoverExample: React.FC = () => ( - - - - -

Bottom

- -
- - Content - -
- - -

Top

-
- - Content - -
- - -

Right

-
- - Content - -
- - -

Left

-
- - Content - -
-
-
+ + + + +

+ Bottom{" "} + + + +

+
+ + Content + +
+ + +

+ Top{" "} + + + +

+
+ + Content + +
+ + +

+ Right{" "} + + + +

+
+ + Content + +
+ + +

+ Left{" "} + + + +

+
+ + Content + +
+
+
); diff --git a/internal/ui/package.json b/internal/ui/package.json index eda260712..08f4f2dff 100644 --- a/internal/ui/package.json +++ b/internal/ui/package.json @@ -13,7 +13,6 @@ "@unkey/tsconfig": "workspace:^", "tailwindcss": "^3.4.15", "typescript": "^5.5.3" - }, "dependencies": { "@radix-ui/react-tooltip": "^1.0.7", diff --git a/internal/ui/src/components/id.tsx b/internal/ui/src/components/id.tsx index e84ef8c66..1a02ca0ed 100644 --- a/internal/ui/src/components/id.tsx +++ b/internal/ui/src/components/id.tsx @@ -1,61 +1,65 @@ "use client"; +import { TaskChecked, TaskUnchecked } from "@unkey/icons"; import * as React from "react"; import { cn } from "../lib/utils"; import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip"; -import { TaskUnchecked, TaskChecked } from "@unkey/icons" type IdProps = { - value: string; - truncate?: number; - className?: string; + value: string; + truncate?: number; + className?: string; }; export const Id: React.FC = ({ className, value, truncate, ...props }) => { - const [isCopied, setIsCopied] = React.useState(false); - const copyTextToClipboard = async (value: string) => { - try { - await navigator.clipboard.writeText(value ?? ""); - setIsCopied(true); - } catch (error) { - console.error('Failed to copy: ', error); - } - }; + const [isCopied, setIsCopied] = React.useState(false); + const copyTextToClipboard = async (value: string) => { + try { + await navigator.clipboard.writeText(value ?? ""); + setIsCopied(true); + } catch (error) { + console.error("Failed to copy: ", error); + } + }; - React.useEffect(() => { - if (!isCopied) { - return; - } - const timer = setTimeout(() => { - setIsCopied(false); - }, 2000); - return () => clearTimeout(timer); - }, [isCopied]); + React.useEffect(() => { + if (!isCopied) { + return; + } + const timer = setTimeout(() => { + setIsCopied(false); + }, 2000); + return () => clearTimeout(timer); + }, [isCopied]); - const ellipse = '••••'; - const truncateValue = truncate ? value?.slice(0, truncate) + ellipse : value; - const Comp = "button"; + const ellipse = "••••"; + const truncateValue = truncate ? value?.slice(0, truncate) + ellipse : value; + const Comp = "button"; - return ( - copyTextToClipboard(value ?? "")} - {...props} - > - {truncateValue} - -
- -
- {!isCopied ? : } -
-
- - Copy ID - -
-
-
); + return ( + copyTextToClipboard(value ?? "")} + {...props} + > + {truncateValue} + +
+ +
+ {!isCopied ? ( + + ) : ( + + )} +
+
+ Copy ID +
+
+
+ ); }; Id.displayName = "Id"; - - diff --git a/internal/ui/src/components/tooltip.tsx b/internal/ui/src/components/tooltip.tsx index e0077f540..d2b1cc3b7 100644 --- a/internal/ui/src/components/tooltip.tsx +++ b/internal/ui/src/components/tooltip.tsx @@ -4,7 +4,7 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip"; import * as React from "react"; import { cn } from "../lib/utils"; - // Adjust the import path as necessary +// Adjust the import path as necessary const TooltipProvider = TooltipPrimitive.Provider; @@ -28,5 +28,4 @@ const TooltipContent = React.forwardRef< )); TooltipContent.displayName = TooltipPrimitive.Content.displayName; - export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };