mirror of
https://github.com/penpot/penpot.git
synced 2025-06-12 22:31:39 +02:00
✨ Improve event registry.
This commit is contained in:
parent
b5b97f7626
commit
926fa483b9
25 changed files with 245 additions and 93 deletions
|
@ -12,12 +12,14 @@
|
|||
[beicon.core :as rx]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc copy-button [{:keys [data]}]
|
||||
(mf/defc copy-button [{:keys [data on-copied]}]
|
||||
(let [just-copied (mf/use-state false)]
|
||||
(mf/use-effect
|
||||
(mf/deps @just-copied)
|
||||
(fn []
|
||||
(when @just-copied
|
||||
(when (fn? on-copied)
|
||||
(on-copied))
|
||||
(let [sub (timers/schedule 1000 #(reset! just-copied false))]
|
||||
;; On unmount we dispose the timer
|
||||
#(rx/-dispose sub)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue