Files
Compass/web/components/widgets/info-tooltip.tsx
Martin Braquet ba9b3cfb06 Add pretty formatting (#29)
* Test

* Add pretty formatting

* Fix Tests

* Fix Tests

* Fix Tests

* Fix

* Add pretty formatting fix

* Fix

* Test

* Fix tests

* Clean typeckech

* Add prettier check

* Fix api tsconfig

* Fix api tsconfig

* Fix tsconfig

* Fix

* Fix

* Prettier
2026-02-20 17:32:27 +01:00

43 lines
1.1 KiB
TypeScript

import {Placement} from '@floating-ui/react'
import {InformationCircleIcon} from '@heroicons/react/outline'
import clsx from 'clsx'
import {Tooltip} from './tooltip'
export function InfoTooltip(props: {
text: string
className?: string
children?: React.ReactNode
size?: 'sm' | 'md' | 'lg'
tooltipParams?: {
className?: string
placement?: Placement
}
}) {
const {text, className, children, size, tooltipParams} = props
return (
<Tooltip
className={clsx('inline-block', tooltipParams?.className)}
text={text}
placement={tooltipParams?.placement}
>
{children ? (
<span className={clsx('border-ink-600 cursor-help border-b border-dotted', className)}>
{children}
</span>
) : (
<InformationCircleIcon
className={clsx(
'text-ink-500 -mb-1',
className,
size === 'sm' && 'h-4 w-4',
size === 'md' && 'h-5 w-5',
size === 'lg' && 'h-6 w-6',
!size && 'h-5 w-5',
)}
/>
)}
</Tooltip>
)
}