mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 04:49:03 -05:00
💄 Add minor cosmetic fixes to link react component
This commit is contained in:
parent
870e4f96b2
commit
0ea07469d2
1 changed files with 7 additions and 4 deletions
|
@ -6,16 +6,19 @@
|
||||||
|
|
||||||
(ns app.main.ui.components.link
|
(ns app.main.ui.components.link
|
||||||
(:require
|
(:require
|
||||||
|
[app.common.data :as d]
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc link [{:keys [action klass data-test keyboard-action children]}]
|
(mf/defc link
|
||||||
(let [keyboard-action (or keyboard-action action)]
|
{::mf/wrap-props false}
|
||||||
|
[{:keys [action klass data-test keyboard-action children]}]
|
||||||
|
(let [keyboard-action (d/nilv keyboard-action action)]
|
||||||
[:a {:on-click action
|
[:a {:on-click action
|
||||||
:class klass
|
:class klass
|
||||||
:on-key-down (fn [event]
|
:on-key-down (fn [event]
|
||||||
(when (kbd/enter? event)
|
(when ^boolean (kbd/enter? event)
|
||||||
(keyboard-action event)))
|
(keyboard-action event)))
|
||||||
:tab-index "0"
|
:tab-index "0"
|
||||||
:data-test data-test}
|
:data-test data-test}
|
||||||
[:* children]]))
|
children]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue