mirror of
https://github.com/penpot/penpot.git
synced 2025-07-16 15:55:16 +02:00
♻️ Update button-icon with tooltip component (#6539)
* 🐛 Add tooltip to base icon button * 🎉 Update id prop * 🐛 Fix test
This commit is contained in:
parent
55997a3d4a
commit
a2abaea637
10 changed files with 60 additions and 39 deletions
|
@ -42,7 +42,7 @@
|
|||
|
||||
"left"
|
||||
{:top (- (+ trigger-top (/ trigger-height 2) half-arrow-height) (/ tooltip-height 2))
|
||||
:left (- trigger-left tooltip-width)
|
||||
:left (- trigger-left tooltip-width arrow-height)
|
||||
:right (+ (- trigger-left tooltip-width) tooltip-width)
|
||||
:bottom (+ (- (+ trigger-top (/ trigger-height 2) half-arrow-height) (/ tooltip-height 2)) tooltip-height)
|
||||
:width tooltip-width
|
||||
|
@ -109,7 +109,7 @@
|
|||
(def ^:private schema:tooltip
|
||||
[:map
|
||||
[:class {:optional true} :string]
|
||||
[:id :string]
|
||||
[:id {:optional true} :string]
|
||||
[:offset {:optional true} :int]
|
||||
[:delay {:optional true} :int]
|
||||
[:placement {:optional true}
|
||||
|
@ -118,7 +118,8 @@
|
|||
(mf/defc tooltip*
|
||||
{::mf/schema schema:tooltip}
|
||||
[{:keys [class id children tooltip-content placement offset delay] :rest props}]
|
||||
(let [placement* (mf/use-state #(d/nilv placement "top"))
|
||||
(let [id (or id (mf/use-id))
|
||||
placement* (mf/use-state #(d/nilv placement "top"))
|
||||
placement (deref placement*)
|
||||
delay (d/nilv delay 300)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue