| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @flow |
| 8 | */ |
| 9 | |
| 10 | import * as React from 'react'; |
| 11 | import ReachTooltip from '@reach/tooltip'; |
| 12 | import tooltipStyles from './Tooltip.css'; |
| 13 | import useThemeStyles from '../../useThemeStyles'; |
| 14 | |
| 15 | const Tooltip = ({ |
| 16 | children, |
| 17 | className = '', |
| 18 | ...props |
| 19 | }: { |
| 20 | children: React$Node, |
| 21 | className: string, |
| 22 | ... |
| 23 | }): React.Node => { |
| 24 | const style = useThemeStyles(); |
| 25 | return ( |
| 26 | // $FlowFixMe[cannot-spread-inexact] unsafe spread |
| 27 | <ReachTooltip |
| 28 | className={`${tooltipStyles.Tooltip} ${className}`} |
| 29 | style={style} |
| 30 | {...props}> |
| 31 | {children} |
| 32 | </ReachTooltip> |
| 33 | ); |
| 34 | }; |
| 35 | |
| 36 | export default Tooltip; |