From e10d271e223d29817ea47a11c36ca6c560561923 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 27 Jun 2023 15:26:53 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20refactor(ShadTooltipComponent):?= =?UTF-8?q?=20destructure=20props=20and=20add=20types=20The=20ShadTooltipC?= =?UTF-8?q?omponent=20has=20been=20refactored=20to=20destructure=20the=20p?= =?UTF-8?q?rops=20and=20add=20types=20to=20improve=20readability=20and=20m?= =?UTF-8?q?aintainability.=20The=20ShadTooltipProps=20type=20has=20been=20?= =?UTF-8?q?added=20to=20the=20types/components/index.ts=20file=20to=20defi?= =?UTF-8?q?ne=20the=20expected=20props=20for=20the=20ShadTooltipComponent.?= =?UTF-8?q?=20The=20delayDuration,=20side,=20content,=20and=20children=20p?= =?UTF-8?q?rops=20are=20now=20destructured=20from=20the=20props=20object?= =?UTF-8?q?=20and=20have=20their=20respective=20types=20defined.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ShadTooltipComponent/index.tsx | 20 ++++++++++--------- src/frontend/src/types/components/index.ts | 9 +++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/components/ShadTooltipComponent/index.tsx b/src/frontend/src/components/ShadTooltipComponent/index.tsx index 44ffac075..aa31b534b 100644 --- a/src/frontend/src/components/ShadTooltipComponent/index.tsx +++ b/src/frontend/src/components/ShadTooltipComponent/index.tsx @@ -1,3 +1,4 @@ +import { ShadTooltipProps } from "../../types/components"; import { Tooltip, TooltipContent, @@ -5,18 +6,19 @@ import { TooltipTrigger, } from "../ui/tooltip"; -const ShadTooltip = (props) => { +const ShadTooltip = ({ + delayDuration = 500, + side, + content, + children, +}: ShadTooltipProps) => { return ( - - {props.children} + + {children} - - {props.content} + + {content} diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index b1570ddda..2ac6960fd 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -110,3 +110,12 @@ export type RadialProgressType = { value?: number; color?: string; }; + +export type Side = "top" | "right" | "bottom" | "left"; + +export type ShadTooltipProps = { + delayDuration?: number; + side?: Side; + content: ReactNode; + children: ReactNode; +};