Add tooltip Offset
parent
d0f54cb9a6
commit
7f6e555cf2
|
@ -268,6 +268,7 @@ function EventTypeSingleLayout({
|
|||
</Skeleton>
|
||||
)}
|
||||
<Tooltip
|
||||
sideOffset={4}
|
||||
content={
|
||||
formMethods.watch("hidden") ? t("show_eventtype_on_profile") : t("hide_from_profile")
|
||||
}
|
||||
|
@ -292,7 +293,7 @@ function EventTypeSingleLayout({
|
|||
{!isManagedEventType && (
|
||||
<>
|
||||
{/* We have to warp this in tooltip as it has a href which disabels the tooltip on buttons */}
|
||||
<Tooltip content={t("preview")} side="bottom">
|
||||
<Tooltip content={t("preview")} side="bottom" sideOffset={4}>
|
||||
<Button
|
||||
color="secondary"
|
||||
data-testid="preview-button"
|
||||
|
@ -309,7 +310,8 @@ function EventTypeSingleLayout({
|
|||
variant="icon"
|
||||
StartIcon={LinkIcon}
|
||||
tooltip={t("copy_link")}
|
||||
tooltipPosition="bottom"
|
||||
tooltipSide="bottom"
|
||||
tooltipOffset={4}
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(permalink);
|
||||
showToast("Link copied!", "success");
|
||||
|
@ -321,7 +323,8 @@ function EventTypeSingleLayout({
|
|||
color="secondary"
|
||||
variant="icon"
|
||||
tooltip={t("embed")}
|
||||
side="bottom"
|
||||
tooltipSide="bottom"
|
||||
tooltipOffset={4}
|
||||
eventId={eventType.id}
|
||||
/>
|
||||
</>
|
||||
|
@ -332,7 +335,8 @@ function EventTypeSingleLayout({
|
|||
variant="icon"
|
||||
StartIcon={Trash}
|
||||
tooltip={t("delete")}
|
||||
tooltipPosition="bottom"
|
||||
tooltipSide="bottom"
|
||||
tooltipOffset={4}
|
||||
disabled={!hasPermsToDelete}
|
||||
onClick={() => setDeleteDialogOpen(true)}
|
||||
/>
|
||||
|
|
|
@ -23,7 +23,8 @@ export type ButtonBaseProps = {
|
|||
shallow?: boolean;
|
||||
/**Tool tip used when icon size is set to small */
|
||||
tooltip?: string;
|
||||
tooltipPosition?: "top" | "right" | "bottom" | "left";
|
||||
tooltipSide?: "top" | "right" | "bottom" | "left";
|
||||
tooltipOffset?: number;
|
||||
disabled?: boolean;
|
||||
flex?: boolean;
|
||||
} & Omit<InferredVariantProps, "color"> & {
|
||||
|
@ -124,7 +125,8 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
|||
size,
|
||||
variant = "button",
|
||||
type = "button",
|
||||
tooltipPosition = "top",
|
||||
tooltipSide = "top",
|
||||
tooltipOffset = 4,
|
||||
StartIcon,
|
||||
EndIcon,
|
||||
shallow,
|
||||
|
@ -215,7 +217,11 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
|||
{element}
|
||||
</Link>
|
||||
) : (
|
||||
<Wrapper data-testid="wrapper" tooltip={props.tooltip} tooltipPosition={tooltipPosition}>
|
||||
<Wrapper
|
||||
data-testid="wrapper"
|
||||
tooltip={props.tooltip}
|
||||
tooltipSide={tooltipSide}
|
||||
tooltipOffset={tooltipOffset}>
|
||||
{element}
|
||||
</Wrapper>
|
||||
);
|
||||
|
@ -224,18 +230,20 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
|||
const Wrapper = ({
|
||||
children,
|
||||
tooltip,
|
||||
tooltipPosition,
|
||||
tooltipSide,
|
||||
tooltipOffset,
|
||||
}: {
|
||||
tooltip?: string;
|
||||
children: React.ReactNode;
|
||||
tooltipPosition?: "top" | "right" | "bottom" | "left";
|
||||
tooltipSide?: "top" | "right" | "bottom" | "left";
|
||||
tooltipOffset?: number;
|
||||
}) => {
|
||||
if (!tooltip) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip data-testid="tooltip" content={tooltip} side={tooltipPosition}>
|
||||
<Tooltip data-testid="tooltip" content={tooltip} side={tooltipSide} sideOffset={tooltipOffset}>
|
||||
{children}
|
||||
</Tooltip>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue