You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TooltipWrapper.js 891B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // @flow
  2. import Tooltip from '@atlaskit/tooltip';
  3. import React from 'react';
  4. import { isMobileBrowser } from '../../environment/utils';
  5. type Props = {
  6. /**
  7. * Children of the component.
  8. */
  9. children: React$Node,
  10. /**
  11. * The text to be displayed in the tooltip.
  12. */
  13. content?: string | null,
  14. /**
  15. * The position of the tooltip relative to the element it contains.
  16. */
  17. position?: string
  18. }
  19. /**
  20. * Wrapper of AtlasKit Tooltip that doesn't render the actual tooltip in mobile browsers.
  21. *
  22. * @returns {ReactElement}
  23. */
  24. function TooltipWrapper({
  25. children,
  26. content,
  27. position
  28. }: Props) {
  29. if (isMobileBrowser()) {
  30. return children;
  31. }
  32. return (
  33. <Tooltip
  34. content = { content }
  35. position = { position }>
  36. {children}
  37. </Tooltip>
  38. );
  39. }
  40. export default TooltipWrapper;