Clean up tooltip markup
This commit is contained in:
parent
465be9f5ad
commit
7faf64552d
|
@ -11,7 +11,6 @@ import {
|
||||||
useRole,
|
useRole,
|
||||||
} from '@floating-ui/react-dom-interactions'
|
} from '@floating-ui/react-dom-interactions'
|
||||||
import { Transition } from '@headlessui/react'
|
import { Transition } from '@headlessui/react'
|
||||||
import clsx from 'clsx'
|
|
||||||
import { ReactNode, useRef, useState } from 'react'
|
import { ReactNode, useRef, useState } from 'react'
|
||||||
|
|
||||||
// See https://floating-ui.com/docs/react-dom
|
// See https://floating-ui.com/docs/react-dom
|
||||||
|
@ -58,14 +57,10 @@ export function Tooltip(props: {
|
||||||
}[placement.split('-')[0]] as string
|
}[placement.split('-')[0]] as string
|
||||||
|
|
||||||
return text ? (
|
return text ? (
|
||||||
<div className="contents">
|
<>
|
||||||
<div
|
<span className={className} ref={reference} {...getReferenceProps()}>
|
||||||
className={clsx('inline-block', className)}
|
|
||||||
ref={reference}
|
|
||||||
{...getReferenceProps()}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</span>
|
||||||
{/* conditionally render tooltip and fade in/out */}
|
{/* conditionally render tooltip and fade in/out */}
|
||||||
<Transition
|
<Transition
|
||||||
show={open}
|
show={open}
|
||||||
|
@ -95,7 +90,7 @@ export function Tooltip(props: {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Transition>
|
</Transition>
|
||||||
</div>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>{children}</>
|
<>{children}</>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user