github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/ui/Tooltip.tsx (about)

     1  /* eslint-disable 
     2  jsx-a11y/click-events-have-key-events, 
     3  jsx-a11y/no-noninteractive-element-interactions, 
     4  css-modules/no-unused-class 
     5  */
     6  import React from 'react';
     7  import MuiTooltip from '@mui/material/Tooltip';
     8  import styles from './Tooltip.module.scss';
     9  
    10  // Don't expose all props from the lib
    11  type AvailableProps = Pick<
    12    React.ComponentProps<typeof MuiTooltip>,
    13    'title' | 'children' | 'placement'
    14  >;
    15  function Tooltip(props: AvailableProps) {
    16    const defaultProps: Omit<
    17      React.ComponentProps<typeof MuiTooltip>,
    18      'title' | 'children'
    19    > = {
    20      arrow: true,
    21      classes: {
    22        tooltip: styles.muiTooltip,
    23        arrow: styles.muiTooltipArrow,
    24      },
    25    };
    26  
    27    /* eslint-disable-next-line react/jsx-props-no-spreading */
    28    return <MuiTooltip {...defaultProps} {...props} />;
    29  }
    30  
    31  export { Tooltip };