Align props with figma
This commit is contained in:
@@ -3,9 +3,12 @@
|
||||
import { memo, useState } from "react";
|
||||
import { TooltipView } from "./Tooltip.view";
|
||||
import type { TooltipProps } from "./Tooltip.types";
|
||||
import { normalizeTooltipPosition } from "../../../lib/propNormalization";
|
||||
|
||||
const TooltipContainer = memo<TooltipProps>(
|
||||
({ children, text, position = "top", className = "", disabled = false }) => {
|
||||
({ children, text, position: positionProp = "top", className = "", disabled = false }) => {
|
||||
// Normalize props to handle both PascalCase (Figma) and lowercase (codebase)
|
||||
const position = normalizeTooltipPosition(positionProp);
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
if (disabled) {
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
export type TooltipPositionValue = "top" | "bottom" | "Top" | "Bottom";
|
||||
|
||||
export interface TooltipProps {
|
||||
children: React.ReactNode;
|
||||
text: string;
|
||||
position?: "top" | "bottom";
|
||||
/**
|
||||
* Tooltip position. Accepts both lowercase and PascalCase (case-insensitive).
|
||||
* Figma uses PascalCase, codebase uses lowercase - both are supported.
|
||||
*/
|
||||
position?: TooltipPositionValue;
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user