import { Text } from "@flip.id/ui-kit"; import ArrowTooltip from "../../../icons/function/ArrowTooltip"; import { Center, VStack, Box, Flex, IconButton } from "native-base"; import React from "react"; import type { AccessibilityProps } from "react-native"; import Close from "../../../icons/function/Close"; import ArrowTooltipDown from "../../../icons/function/ArrowTooltipDown"; import type { IFlipColors } from "../../../config/interfaces/IFlipColors"; import type { IColors } from "native-base/lib/typescript/theme/base/colors"; import EnhancedTouchableOpacity from "../EnhancedTouchableOpacity"; export interface ITooltip { title?: string; label: string; onPressClose?: () => void; arrowPosition: "top" | "bottom" | "top-left" | "bottom-left"; onPressButton?: () => void; color: IFlipColors | IColors; isClosableButton?: boolean; isClosableClick?: boolean; as?: React.ComponentType; closeButtonSize?: number | string; closeButtonAccessibilityLabel?: string; } export const Tooltip: React.FC = (props) => { const { onPressClose, arrowPosition, onPressButton, isClosableButton, isClosableClick, color, as, closeButtonSize, closeButtonAccessibilityLabel, } = props; const ArrowTop = () => { switch (arrowPosition) { case "top": return (
); case "top-left": return ( ); default: return null; } }; return (
{props.title && props.title.length > 0 && ( {props.title} )} {props.label} {isClosableClick && onPressButton && ( Click Me! )}
{as && isClosableButton && onPressClose && ( )} {!as && isClosableButton && onPressClose && ( )}
{arrowPosition === "bottom-left" && ( )} {arrowPosition === "bottom" && (
)}
); }; export default Tooltip;