From e496cec49fd1724ed3eede73fefb5275a71e0c27 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:19:34 +0530 Subject: [PATCH] chore: code refactor (#2450) --- packages/ui/package.json | 4 +- packages/ui/src/button/button.tsx | 4 +- packages/ui/src/tooltip/tooltip.tsx | 71 ++++++++++++----------------- 3 files changed, 31 insertions(+), 48 deletions(-) diff --git a/packages/ui/package.json b/packages/ui/package.json index 603d0e250..4eb7ac8b8 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -33,8 +33,6 @@ "dependencies": { "@blueprintjs/core": "^4.16.3", "@blueprintjs/popover2": "^1.13.3", - "@headlessui/react": "^1.7.17", - "clsx": "^2.0.0", - "next-themes": "^0.2.1" + "@headlessui/react": "^1.7.17" } } diff --git a/packages/ui/src/button/button.tsx b/packages/ui/src/button/button.tsx index 706b0ae6c..138e105e0 100644 --- a/packages/ui/src/button/button.tsx +++ b/packages/ui/src/button/button.tsx @@ -47,13 +47,13 @@ const Button = React.forwardRef( > {prependIcon && (
- {React.cloneElement(prependIcon, { "stroke-width": 2 })} + {React.cloneElement(prependIcon, { strokeWidth: 2 })}
)} {children} {appendIcon && (
- {React.cloneElement(appendIcon, { "stroke-width": 2 })} + {React.cloneElement(appendIcon, { strokeWidth: 2 })}
)} diff --git a/packages/ui/src/tooltip/tooltip.tsx b/packages/ui/src/tooltip/tooltip.tsx index ca25cd3e1..96bf45aa3 100644 --- a/packages/ui/src/tooltip/tooltip.tsx +++ b/packages/ui/src/tooltip/tooltip.tsx @@ -1,7 +1,6 @@ import React from "react"; // next-themes -import { useTheme } from "next-themes"; import { Tooltip2 } from "@blueprintjs/popover2"; export type TPosition = @@ -41,46 +40,32 @@ export const Tooltip: React.FC = ({ className = "", openDelay = 200, closeDelay, -}) => { - const { theme } = useTheme(); - - return ( - - {tooltipHeading && ( -
- {tooltipHeading} -
- )} - {tooltipContent} - - } - position={position} - renderTarget={({ - isOpen: isTooltipOpen, +}) => ( + + {tooltipHeading && ( +
{tooltipHeading}
+ )} + {tooltipContent} + + } + position={position} + renderTarget={({ + isOpen: isTooltipOpen, + ref: eleReference, + ...tooltipProps + }) => + React.cloneElement(children, { ref: eleReference, - ...tooltipProps - }) => - React.cloneElement(children, { - ref: eleReference, - ...tooltipProps, - ...children.props, - }) - } - /> - ); -}; + ...tooltipProps, + ...children.props, + }) + } + /> +);