mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 13:08:28 +02:00
♻️ Refactor button-link component
This commit is contained in:
parent
1e9c809b84
commit
e60be6f262
2 changed files with 33 additions and 27 deletions
|
@ -11,16 +11,17 @@
|
|||
|
||||
(mf/defc button-link
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [action icon name klass]}]
|
||||
[{:keys [on-click icon label class]}]
|
||||
(let [on-key-down (mf/use-fn
|
||||
(mf/deps action)
|
||||
(mf/deps on-click)
|
||||
(fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(action event))))]
|
||||
(when (fn? on-click)
|
||||
(on-click event)))))]
|
||||
[:a.btn-primary.btn-large.button-link
|
||||
{:class klass
|
||||
{:class class
|
||||
:tab-index "0"
|
||||
:on-click action
|
||||
:on-click on-click
|
||||
:on-key-down on-key-down}
|
||||
[:span.logo icon]
|
||||
name]))
|
||||
label]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue