mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-03-01 12:44:17 +00:00
hide tooltips on select position
This commit is contained in:
parent
467f7c249b
commit
7ba2ded1d1
@ -61,7 +61,7 @@
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitest/coverage-v8": "^3.0.5",
|
||||
"cypress": "^14.0.3",
|
||||
"daisyui": "^5.0.6",
|
||||
"daisyui": "^5.2.3",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import { useState } from 'react'
|
||||
import SVG from 'react-inlinesvg'
|
||||
|
||||
import PlusSVG from '#assets/plus.svg'
|
||||
@ -18,6 +19,7 @@ export default function AddButton({
|
||||
const appState = useAppState()
|
||||
const { width } = useWindowDimensions()
|
||||
const isMobile = width < 768
|
||||
const [hideTooltips, setHideTooltips] = useState(false)
|
||||
|
||||
const canAddItems = () => {
|
||||
let canAdd = false
|
||||
@ -33,6 +35,14 @@ export default function AddButton({
|
||||
return canAdd
|
||||
}
|
||||
|
||||
const handleLayerClick = (layer: any) => {
|
||||
triggerAction(layer)
|
||||
// Verstecke Tooltips auf Mobile nach Layer-Auswahl
|
||||
if (isMobile) {
|
||||
setHideTooltips(true)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{canAddItems() ? (
|
||||
@ -40,6 +50,16 @@ export default function AddButton({
|
||||
<label
|
||||
tabIndex={0}
|
||||
className='tw:z-500 tw:btn tw:btn-circle tw:btn-lg tw:shadow tw:bg-base-100'
|
||||
onClick={() => {
|
||||
if (hideTooltips) {
|
||||
setHideTooltips(false)
|
||||
}
|
||||
}}
|
||||
onTouchEnd={() => {
|
||||
if (hideTooltips) {
|
||||
setHideTooltips(false)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SVG src={PlusSVG} className='tw:h-5 tw:w-5' />
|
||||
</label>
|
||||
@ -55,7 +75,7 @@ export default function AddButton({
|
||||
<li key={layer.name}>
|
||||
<a>
|
||||
<div
|
||||
className={`tw:tooltip tw:tooltip-left ${isMobile ? 'tw:tooltip-open' : ''}`}
|
||||
className={`tw:tooltip tw:tooltip-left ${isMobile && !hideTooltips ? 'tw:tooltip-open' : ''}`}
|
||||
data-tip={layer.menuText}
|
||||
style={
|
||||
{
|
||||
@ -68,11 +88,9 @@ export default function AddButton({
|
||||
tabIndex={0}
|
||||
className='tw:z-500 tw:border-0 tw:p-0 tw:w-10 tw:h-10 tw:cursor-pointer tw:rounded-full tw:mouse tw:drop-shadow-md tw:transition tw:ease-in tw:duration-200 tw:focus:outline-hidden tw:flex tw:items-center tw:justify-center'
|
||||
style={{ backgroundColor: layer.menuColor || '#777' }}
|
||||
onClick={() => {
|
||||
triggerAction(layer)
|
||||
}}
|
||||
onClick={() => handleLayerClick(layer)}
|
||||
onTouchEnd={(e) => {
|
||||
triggerAction(layer)
|
||||
handleLayerClick(layer)
|
||||
e.preventDefault()
|
||||
}}
|
||||
>
|
||||
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@ -121,7 +121,7 @@
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitest/coverage-v8": "^3.0.5",
|
||||
"cypress": "^14.0.3",
|
||||
"daisyui": "^5.0.6",
|
||||
"daisyui": "^5.2.3",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
@ -7004,9 +7004,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/daisyui": {
|
||||
"version": "5.1.29",
|
||||
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.1.29.tgz",
|
||||
"integrity": "sha512-4eZhqCXO7CJVNGytTZEIQYJz3fah2gPleuqp4qUD4fD8WoEQIYzKwlOewi8nPaz6NX7vvSLZ+YSjt5Z5zqacGw==",
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.2.3.tgz",
|
||||
"integrity": "sha512-sldBQUIFCsSPoF4LvoHhIi9GnvBX/3aZD9NoTOvpTSX8sDjO484wQx7yEvRyREMpn4rZMvQSKKskHAHdM8+B4Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user