Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Mar 4, 2024
1 parent 9d16730 commit 30a212b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/components/ui/float-popover/FloatPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import React, {
} from 'react'
import { AnimatePresence, m } from 'framer-motion'
import type { UseFloatingOptions } from '@floating-ui/react-dom'
import type { FC, PropsWithChildren } from 'react'
import type { FC, PropsWithChildren, ReactElement } from 'react'

import { microReboundPreset } from '~/constants/spring'
import useClickAway from '~/hooks/common/use-click-away'
Expand All @@ -29,7 +29,7 @@ import { clsxm } from '~/lib/helper'
import { RootPortal } from '../portal'

type FloatPopoverProps<T> = PropsWithChildren<{
triggerElement?: React.ReactNode
triggerElement?: string | ReactElement
TriggerComponent?: FC<T>

headless?: boolean
Expand Down Expand Up @@ -181,10 +181,13 @@ export const FloatPopover = function FloatPopover<T extends {}>(
<></>
)
const TriggerWrapper = asChild ? (
React.cloneElement(Child, {
...listener,
ref: refs.setReference,
})
React.cloneElement(
typeof Child === 'string' ? <span>{Child}</span> : Child,
{
...listener,
ref: refs.setReference,
},
)
) : (
<As
// @ts-ignore
Expand Down

0 comments on commit 30a212b

Please sign in to comment.