diff --git a/src/components/Navigation/Navigation.jsx b/src/components/Navigation/Navigation.jsx index 62e1886d3561..d709b43d2cb0 100644 --- a/src/components/Navigation/Navigation.jsx +++ b/src/components/Navigation/Navigation.jsx @@ -8,6 +8,7 @@ import { Link as ReactDOMLink, NavLink, useLocation } from 'react-router-dom'; import Link from '../Link/Link'; import Logo from '../Logo/Logo'; import Dropdown from '../Dropdown/Dropdown'; +import Tooltip from '../Tooltip/Tooltip'; // Load Styling import '@docsearch/css'; @@ -70,14 +71,15 @@ NavigationIcon.propTypes = { }; function NavigationIcon({ children, to, title }) { return ( - - {children} - + + + {children} + + ); } const navigationIconProps = { diff --git a/src/components/Support/Support.jsx b/src/components/Support/Support.jsx index ac50bbd5e47c..1637cf4eef13 100644 --- a/src/components/Support/Support.jsx +++ b/src/components/Support/Support.jsx @@ -7,6 +7,7 @@ import VisibilitySensor from 'react-visibility-sensor'; import Backers from './_supporters.json'; import Additional from './AdditionalSupporters'; import SmallIcon from '../../assets/icon-square-small-slack.png'; +import Tooltip from '../Tooltip/Tooltip'; // Load Styling import './Support.scss'; @@ -225,34 +226,39 @@ export default class Support extends Component { {supporters.map((supporter, index) => ( - - { - { - } - + + { + { + } + + ))}
diff --git a/src/components/Tooltip/Tooltip.jsx b/src/components/Tooltip/Tooltip.jsx new file mode 100644 index 000000000000..3faab6871b5c --- /dev/null +++ b/src/components/Tooltip/Tooltip.jsx @@ -0,0 +1,96 @@ +import { useState } from 'react'; +import PropTypes from 'prop-types'; +const Tooltip = ({ + children, + content, + position = 'bottom', + delay = 300, + className = '', +}) => { + const [isVisible, setIsVisible] = useState(false); + const [isDelayed, setIsDelayed] = useState(false); + const showTooltip = () => { + const timer = setTimeout(() => { + setIsDelayed(true); + }, delay); + setIsVisible(true); + return () => clearTimeout(timer); + }; + const hideTooltip = () => { + setIsVisible(false); + setIsDelayed(false); + }; + // Position classes - increase the margins to create more space + const positions = { + top: 'bottom-full left-1/2 -translate-x-1/2 mb-8', + bottom: 'top-full left-1/2 -translate-x-1/2 mt-10', + left: 'right-full top-1/2 -translate-y-1/2 mr-8', + right: 'left-full top-1/2 -translate-y-1/2 ml-8', + }; + // Custom background color for both tooltip and triangle + const bgColor = '#526B78'; + return ( +
+ {children} + {isVisible && ( +
+
+ {content} + {/* Triangle/Arrow - Reduced size */} + {position === 'top' && ( +
+ )} + {position === 'bottom' && ( +
+ )} + {position === 'left' && ( +
+ )} + {position === 'right' && ( +
+ )} +
+
+ )} +
+ ); +}; + +Tooltip.propTypes = { + children: PropTypes.node.isRequired, + content: PropTypes.node.isRequired, + position: PropTypes.oneOf(['top', 'right', 'bottom', 'left']), + delay: PropTypes.number, + className: PropTypes.string, +}; + +export default Tooltip;