mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 05:31:38 +02:00
⚡ Improve performance of button-link component
This commit is contained in:
parent
6ae58a77ed
commit
b5dac770d3
1 changed files with 15 additions and 10 deletions
|
@ -9,13 +9,18 @@
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc button-link [{:keys [action icon name klass]}]
|
(mf/defc button-link
|
||||||
[:a.btn-primary.btn-large.button-link
|
{::mf/wrap-props false}
|
||||||
{:class klass
|
[{:keys [action icon name klass]}]
|
||||||
:tab-index "0"
|
(let [on-key-down (mf/use-fn
|
||||||
:on-click action
|
(mf/deps action)
|
||||||
:on-key-down (fn [event]
|
(fn [event]
|
||||||
(when (kbd/enter? event)
|
(when (kbd/enter? event)
|
||||||
(action event)))}
|
(action event))))]
|
||||||
[:span.logo icon]
|
[:a.btn-primary.btn-large.button-link
|
||||||
name])
|
{:class klass
|
||||||
|
:tab-index "0"
|
||||||
|
:on-click action
|
||||||
|
:on-key-down on-key-down}
|
||||||
|
[:span.logo icon]
|
||||||
|
name]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue