- Remove 'as any' type assertion in LoginScreen.tsx, use Platform.OS check - Fix malformed className string in LogoutButton.tsx (extra quotes) - Remove @ts-ignore comments in Tooltip.tsx with proper web-specific types - Replace 'any' type with Schedule type in AvailabilityTab.tsx - Replace 'any' type with 'string' for SF Symbol icons in EventTypeListItem.ios.tsx - Remove console.log error handling in SvgImage.tsx - Extract duplicated formatDuration function to use shared utility from formatters.ts - Extract repeated inline styles to sectionDividerStyle constant in AvailabilityTab.tsx Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Dhairyashil <dhairyashil10101010@gmail.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import React, { useState } from "react";
|
|
|
|
interface TooltipProps {
|
|
text: string;
|
|
children: React.ReactElement;
|
|
}
|
|
|
|
export function Tooltip({ text, children }: TooltipProps) {
|
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
|
|
const handleMouseEnter = () => {
|
|
setShowTooltip(true);
|
|
};
|
|
|
|
const handleMouseLeave = () => {
|
|
setShowTooltip(false);
|
|
};
|
|
|
|
return (
|
|
<span
|
|
onMouseEnter={handleMouseEnter}
|
|
onMouseLeave={handleMouseLeave}
|
|
style={{ position: "relative", display: "inline-flex" }}
|
|
>
|
|
{children}
|
|
{showTooltip ? (
|
|
<span
|
|
style={{
|
|
position: "absolute",
|
|
left: "50%",
|
|
bottom: "100%",
|
|
transform: "translate(-50%, -8px)",
|
|
backgroundColor: "#1a1a1a",
|
|
padding: "6px 10px",
|
|
borderRadius: 6,
|
|
zIndex: 10002,
|
|
pointerEvents: "none",
|
|
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
color: "white",
|
|
fontSize: 13,
|
|
fontWeight: 600,
|
|
whiteSpace: "nowrap",
|
|
}}
|
|
>
|
|
{text}
|
|
</span>
|
|
) : null}
|
|
</span>
|
|
);
|
|
}
|