mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-03-01 12:44:17 +00:00
fix close button in SelectPosition
This commit is contained in:
parent
e7b04757f0
commit
8ce41ec098
@ -1,3 +1,6 @@
|
||||
import { DomEvent } from 'leaflet'
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
import type { Item } from '#types/Item'
|
||||
import type { LayerProps } from '#types/LayerProps'
|
||||
|
||||
@ -8,11 +11,25 @@ export const SelectPosition = ({
|
||||
setSelectNewItemPosition: React.Dispatch<React.SetStateAction<Item | LayerProps | null>>
|
||||
selectNewItemPosition?: Item | LayerProps | null
|
||||
}) => {
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (containerRef.current) {
|
||||
DomEvent.disableClickPropagation(containerRef.current)
|
||||
DomEvent.disableScrollPropagation(containerRef.current)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className='tw:animate-pulseGrow tw:button tw:z-1000 tw:absolute tw:right-5 tw:top-4 tw:drop-shadow-md'>
|
||||
<div
|
||||
ref={containerRef}
|
||||
className='tw:animate-pulseGrow tw:button tw:z-1000 tw:absolute tw:right-5 tw:top-4 tw:drop-shadow-md'
|
||||
>
|
||||
<label
|
||||
className='tw:btn tw:btn-sm tw:rounded-2xl tw:btn-circle tw:btn-ghost tw:hover:bg-transparent tw:absolute tw:right-0 tw:top-0 tw:text-gray-600'
|
||||
onClick={() => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
setSelectNewItemPosition(null)
|
||||
}}
|
||||
>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user