From 7728cc734a30f0f4742fee1a466a95c6055257e7 Mon Sep 17 00:00:00 2001 From: Alex <33497058+bexsoft@users.noreply.github.com> Date: Mon, 12 Sep 2022 01:29:30 -0500 Subject: [PATCH] Inherits error props to tooltip wrapper child buttons (#2307) --- .../Common/TooltipWrapper/TooltipWrapper.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/portal-ui/src/screens/Console/Common/TooltipWrapper/TooltipWrapper.tsx b/portal-ui/src/screens/Console/Common/TooltipWrapper/TooltipWrapper.tsx index 145d9aeae..2243255d4 100644 --- a/portal-ui/src/screens/Console/Common/TooltipWrapper/TooltipWrapper.tsx +++ b/portal-ui/src/screens/Console/Common/TooltipWrapper/TooltipWrapper.tsx @@ -14,18 +14,25 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import React from "react"; +import React, { cloneElement } from "react"; import { Tooltip } from "@mui/material"; interface ITooltipWrapperProps { tooltip: string; children: any; + errorProps?: any; } -const TooltipWrapper = ({ tooltip, children }: ITooltipWrapperProps) => { +const TooltipWrapper = ({ + tooltip, + children, + errorProps = null, +}: ITooltipWrapperProps) => { return ( - {children} + + {errorProps ? cloneElement(children, { ...errorProps }) : children} + ); };