docs: DX improvements to a workflow / step reference page (#10906)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import React, { useId } from "react"
|
||||
import React, { forwardRef, useId } from "react"
|
||||
import { Tooltip as ReactTooltip } from "react-tooltip"
|
||||
import type { ITooltip } from "react-tooltip"
|
||||
import clsx from "clsx"
|
||||
@@ -15,47 +15,52 @@ export type TooltipProps = {
|
||||
} & React.HTMLAttributes<HTMLSpanElement> &
|
||||
ITooltip
|
||||
|
||||
export const Tooltip = ({
|
||||
text = "",
|
||||
tooltipClassName = "",
|
||||
children,
|
||||
html = "",
|
||||
tooltipChildren,
|
||||
className,
|
||||
innerClassName,
|
||||
...tooltipProps
|
||||
}: TooltipProps) => {
|
||||
const elementId = useId()
|
||||
export const Tooltip = forwardRef<HTMLSpanElement, TooltipProps>(
|
||||
function Tooltip(
|
||||
{
|
||||
text = "",
|
||||
tooltipClassName = "",
|
||||
children,
|
||||
html = "",
|
||||
tooltipChildren,
|
||||
className,
|
||||
innerClassName,
|
||||
...tooltipProps
|
||||
},
|
||||
ref
|
||||
) {
|
||||
const elementId = useId()
|
||||
|
||||
return (
|
||||
<span className={clsx(className, "notranslate")} translate="no">
|
||||
<span
|
||||
id={elementId}
|
||||
data-tooltip-content={text}
|
||||
data-tooltip-html={html}
|
||||
data-tooltip-id={elementId}
|
||||
className={innerClassName}
|
||||
>
|
||||
{children}
|
||||
return (
|
||||
<span className={clsx(className, "notranslate")} translate="no" ref={ref}>
|
||||
<span
|
||||
id={elementId}
|
||||
data-tooltip-content={text}
|
||||
data-tooltip-html={html}
|
||||
data-tooltip-id={elementId}
|
||||
className={innerClassName}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
<ReactTooltip
|
||||
anchorId={elementId}
|
||||
// anchorSelect={elementId ? `#${elementId}` : undefined}
|
||||
className={clsx(
|
||||
"!text-compact-x-small !shadow-elevation-tooltip dark:!shadow-elevation-tooltip-dark !rounded-docs_DEFAULT",
|
||||
"!py-docs_0.25 !z-[399] hidden !px-docs_0.5 lg:block",
|
||||
"!bg-medusa-bg-component",
|
||||
"!text-medusa-fg-base text-center",
|
||||
tooltipClassName
|
||||
)}
|
||||
wrapper="span"
|
||||
noArrow={true}
|
||||
positionStrategy={"fixed"}
|
||||
opacity={1}
|
||||
{...tooltipProps}
|
||||
>
|
||||
{tooltipChildren}
|
||||
</ReactTooltip>
|
||||
</span>
|
||||
<ReactTooltip
|
||||
anchorId={elementId}
|
||||
// anchorSelect={elementId ? `#${elementId}` : undefined}
|
||||
className={clsx(
|
||||
"!text-compact-x-small !shadow-elevation-tooltip dark:!shadow-elevation-tooltip-dark !rounded-docs_DEFAULT",
|
||||
"!py-docs_0.25 !z-[399] hidden !px-docs_0.5 lg:block",
|
||||
"!bg-medusa-bg-component",
|
||||
"!text-medusa-fg-base text-center",
|
||||
tooltipClassName
|
||||
)}
|
||||
wrapper="span"
|
||||
noArrow={true}
|
||||
positionStrategy={"fixed"}
|
||||
opacity={1}
|
||||
{...tooltipProps}
|
||||
>
|
||||
{tooltipChildren}
|
||||
</ReactTooltip>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user