Files
community-rule/app/components/modals/Tooltip/Tooltip.view.tsx
T
adilalloandCursor 2321a1e761 Adopt remaining typography token classes (CR-24)
Map exact size/weight/line-height combos onto existing text-* utilities across cards, sections, navigation, modals, controls, and create-flow. Leave unmappable combos hardcoded for design review.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 11:40:10 -06:00

46 lines
1.2 KiB
TypeScript

import type { TooltipViewProps } from "./Tooltip.types";
export function TooltipView({
text,
position,
className: _className,
tooltipClasses,
pointerClasses,
}: TooltipViewProps) {
// Pointer is 10px tall with 7px sticking out
// Icon_Pointer.svg is 14x8, scale to 10px height = 17.5px width
const pointerWidth = 17.5;
const pointerHeight = 10;
const pointerRotation = position === "top" ? "rotate-180" : "rotate-0";
return (
<div
className={tooltipClasses}
role="tooltip"
aria-live="polite"
id={`tooltip-${text.replace(/\s+/g, "-").toLowerCase()}`}
>
<p className="text-small-label text-[var(--color-content-default-primary)] relative shrink-0">
{text}
</p>
<div
className={pointerClasses}
style={{ width: `${pointerWidth}px`, height: `${pointerHeight}px` }}
>
<svg
className={`${pointerRotation} w-full h-full`}
viewBox="0 0 14 8"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
<path
d="M6.92822 0L13.8564 7.5H1.95503e-05L6.92822 0Z"
fill="var(--color-surface-default-primary)"
/>
</svg>
</div>
</div>
);
}