mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
minor fix
This commit is contained in:
parent
e4bda65be2
commit
bd3cb70d3a
@ -5,6 +5,7 @@
|
||||
width: max-content;
|
||||
background-color: rgb(from var(--block-bg-color) r g b / 70%);
|
||||
color: var(--main-text-color);
|
||||
padding: 4px 8px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
@ -28,12 +28,12 @@ interface TooltipOptions {
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
}
|
||||
|
||||
export function useTooltip({
|
||||
export const useTooltip = ({
|
||||
initialOpen = false,
|
||||
placement = "top",
|
||||
open: controlledOpen,
|
||||
onOpenChange: setControlledOpen,
|
||||
}: TooltipOptions = {}) {
|
||||
}: TooltipOptions = {}) => {
|
||||
const arrowRef = React.useRef(null);
|
||||
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(initialOpen);
|
||||
|
||||
@ -72,7 +72,7 @@ export function useTooltip({
|
||||
}),
|
||||
[open, setOpen, arrowRef, interactions, data]
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
type ContextType = ReturnType<typeof useTooltip> | null;
|
||||
|
||||
@ -88,12 +88,12 @@ export const useTooltipState = () => {
|
||||
return context;
|
||||
};
|
||||
|
||||
export function Tooltip({ children, ...options }: { children: React.ReactNode } & TooltipOptions) {
|
||||
export const Tooltip = ({ children, ...options }: { children: React.ReactNode } & TooltipOptions) => {
|
||||
// This can accept any props as options, e.g. `placement`,
|
||||
// or other positioning options.
|
||||
const tooltip = useTooltip(options);
|
||||
return <TooltipContext.Provider value={tooltip}>{children}</TooltipContext.Provider>;
|
||||
}
|
||||
};
|
||||
|
||||
export const TooltipTrigger = React.forwardRef<HTMLElement, React.HTMLProps<HTMLElement> & { asChild?: boolean }>(
|
||||
function TooltipTrigger({ children, asChild = false, ...props }, propRef) {
|
||||
|
Loading…
Reference in New Issue
Block a user