-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathInformation.tsx
More file actions
60 lines (57 loc) · 1.25 KB
/
Information.tsx
File metadata and controls
60 lines (57 loc) · 1.25 KB
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
53
54
55
56
57
58
59
60
import { Info } from 'lucide-react'
import React from 'react'
import { cn } from '@sqlmesh-common/utils'
import { getTextSize } from './help'
import type { Size } from '@sqlmesh-common/types'
import { Tooltip } from '../Tooltip/Tooltip'
export interface InformationProps {
children?: React.ReactNode
className?: string
classNameTooltip?: string
side?: 'right' | 'left'
size?: Size
sideOffset?: number
delayDuration?: number
info?: React.ReactNode
infoIcon?: React.ReactNode
}
export function Information({
children,
className,
classNameTooltip,
side = 'right',
size = 's',
sideOffset = 4,
delayDuration = 200,
info,
infoIcon = (
<Info
aria-label="Info Icon"
size={16}
/>
),
...props
}: InformationProps) {
return (
<div
data-component="Information"
className={cn('flex items-center gap-2 text-typography-info', className)}
{...props}
>
{children}
<Tooltip
delayDuration={delayDuration}
sideOffset={sideOffset}
side={side}
className={cn(
'z-50 select-none whitespace-wrap rounded-md',
getTextSize(size),
classNameTooltip,
)}
trigger={infoIcon}
>
{info}
</Tooltip>
</div>
)
}