fix: picture action button position

part of #811
This commit is contained in:
Stephen Zhou 2024-10-10 20:11:20 +08:00
parent 81a35e046e
commit b18e4a2bd4
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View File

@ -46,9 +46,9 @@ const Wrapper: Component<{
)}
>
{children}
<RootPortal>
<RootPortal to={entryId ? null : undefined}>
<div
className="pointer-events-auto fixed bottom-4 right-4 z-[99] flex gap-3 text-white/70 [&_button]:hover:text-white"
className="pointer-events-auto absolute bottom-4 right-4 z-[99] flex gap-3 text-white/70 [&_button]:hover:text-white"
onClick={stopPropagation}
>
{showActions && (

View File

@ -5,10 +5,11 @@ import { useRootPortal } from "./provider"
export const RootPortal: FC<
{
to?: HTMLElement
to?: HTMLElement | null
} & PropsWithChildren
> = (props) => {
const to = useRootPortal()
if (props.to === null) return props.children
return createPortal(props.children, props.to || to || document.body)
}