Skip to content

Commit 7728cc7

Browse files
authored
Inherits error props to tooltip wrapper child buttons (#2307)
1 parent cc581c6 commit 7728cc7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

portal-ui/src/screens/Console/Common/TooltipWrapper/TooltipWrapper.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,25 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
import React from "react";
17+
import React, { cloneElement } from "react";
1818
import { Tooltip } from "@mui/material";
1919

2020
interface ITooltipWrapperProps {
2121
tooltip: string;
2222
children: any;
23+
errorProps?: any;
2324
}
2425

25-
const TooltipWrapper = ({ tooltip, children }: ITooltipWrapperProps) => {
26+
const TooltipWrapper = ({
27+
tooltip,
28+
children,
29+
errorProps = null,
30+
}: ITooltipWrapperProps) => {
2631
return (
2732
<Tooltip title={tooltip}>
28-
<span>{children}</span>
33+
<span>
34+
{errorProps ? cloneElement(children, { ...errorProps }) : children}
35+
</span>
2936
</Tooltip>
3037
);
3138
};

0 commit comments

Comments
 (0)