* fix: getEnv not returning fallback API_URL breaking examples app * refactor: use vite as the only way to build atoms * refactor: web use atoms from web.ts and rest from dist * refactor: update atoms version, description and set privacy to public * fix: lib and ui import from web atoms * refactor: rename @calcom/platform-atoms to @calcom/atoms * feat: atoms as npm works with example app outside monorepo * start atoms from v1.0.0 * refactor: monorepo atoms for internal use * document atoms publishing * refactor: remove unused import in v2 * fix: mistakes made during main merge * refactor: move back examples app while still having it in atoms-examples repo * refactor: monorepo examples readme * feat: atoms yarn publish command * refactor: atoms css file simplify * fix: mocking atoms in ui unit test * fix: mocking atoms in app-store unit test
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
import React from "react";
|
|
|
|
import { useIsPlatform } from "@calcom/atoms/monorepo";
|
|
import classNames from "@calcom/lib/classNames";
|
|
|
|
export function Tooltip({
|
|
children,
|
|
content,
|
|
open,
|
|
defaultOpen,
|
|
onOpenChange,
|
|
delayDuration,
|
|
side = "top",
|
|
...props
|
|
}: {
|
|
children: React.ReactNode;
|
|
content: React.ReactNode;
|
|
delayDuration?: number;
|
|
open?: boolean;
|
|
defaultOpen?: boolean;
|
|
side?: "top" | "right" | "bottom" | "left";
|
|
onOpenChange?: (open: boolean) => void;
|
|
} & TooltipPrimitive.TooltipContentProps) {
|
|
const isPlatform = useIsPlatform();
|
|
const Content = (
|
|
<TooltipPrimitive.Content
|
|
{...props}
|
|
className={classNames(
|
|
"calcom-tooltip",
|
|
side === "top" && "-mt-7",
|
|
side === "right" && "ml-2",
|
|
"bg-inverted text-inverted relative z-50 rounded-md px-2 py-1 text-xs font-semibold shadow-lg",
|
|
props.className && `${props.className}`
|
|
)}
|
|
side={side}
|
|
align="center">
|
|
{content}
|
|
</TooltipPrimitive.Content>
|
|
);
|
|
|
|
return (
|
|
<TooltipPrimitive.Root
|
|
delayDuration={delayDuration || 50}
|
|
open={open}
|
|
defaultOpen={defaultOpen}
|
|
onOpenChange={onOpenChange}>
|
|
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
|
|
{isPlatform ? <>{Content}</> : <TooltipPrimitive.Portal>{Content}</TooltipPrimitive.Portal>}
|
|
</TooltipPrimitive.Root>
|
|
);
|
|
}
|
|
|
|
export default Tooltip;
|