-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathindex.tsx
52 lines (46 loc) · 1.18 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*--------------------------------------------------------------------------
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
* All Rights Reserved. Proprietary and confidential.
* Unauthorized copying of this file, via any medium is strictly prohibited
*--------------------------------------------------------------------------
*/
import {
Tooltip as TooltipBase,
TooltipProps,
makeStyles,
} from '@material-ui/core'
type Props = {
children: JSX.Element
content: string | JSX.Element
disableTouchListener?: boolean
placement?: TooltipProps['placement']
interactive?: TooltipProps['interactive']
enterTouchDelay?: TooltipProps['enterTouchDelay']
}
const useStyles = makeStyles(
{
tooltip: {
fontSize: '10px',
padding: '4px 8px',
},
},
{ index: 1 },
)
export const Tooltip = (props: Props) => {
const {
content,
placement = 'top',
enterTouchDelay = 0,
...otherProps
} = props
const classes = useStyles()
return (
<TooltipBase
{...otherProps}
enterTouchDelay={enterTouchDelay}
placement={placement}
title={content}
classes={{ tooltip: classes.tooltip }}
/>
)
}