From 42d2a4d6cb142cd67e41838cd9292a2ee68b879e Mon Sep 17 00:00:00 2001 From: Lennert Claeys Date: Tue, 14 Nov 2023 13:20:35 +0100 Subject: [PATCH 1/5] Add a TooltippedButton It can conditionally work as a disabled button with tooltip --- src/components/dialog/TooltippedButton.tsx | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/components/dialog/TooltippedButton.tsx diff --git a/src/components/dialog/TooltippedButton.tsx b/src/components/dialog/TooltippedButton.tsx new file mode 100644 index 000000000..84526725c --- /dev/null +++ b/src/components/dialog/TooltippedButton.tsx @@ -0,0 +1,46 @@ +import Box from '../box'; +import Button from '../button'; +import Tooltip, { TooltipProps } from '../tooltip'; +import React, { ComponentProps } from 'react'; + +const TooltippedBox = Tooltip(Box); + +const TooltippedButton = (props: ComponentProps & Partial) => { + const { + onTooltipEntered, + tooltip, + tooltipColor, + tooltipHideOnClick, + tooltipIcon, + tooltipPosition, + tooltipShowOnClick, + tooltipSize, + tooltipShowDelay, + tooltipActive, + zIndex, + ...rest + } = props; + + if (!tooltip) { + return