0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

💄 Add minor cosmetic fixes to link react component

This commit is contained in:
Andrey Antukh 2024-01-08 11:19:11 +01:00
parent 870e4f96b2
commit 0ea07469d2

View file

@ -6,16 +6,19 @@
(ns app.main.ui.components.link
(:require
[app.common.data :as d]
[app.util.keyboard :as kbd]
[rumext.v2 :as mf]))
(mf/defc link [{:keys [action klass data-test keyboard-action children]}]
(let [keyboard-action (or keyboard-action action)]
(mf/defc link
{::mf/wrap-props false}
[{:keys [action klass data-test keyboard-action children]}]
(let [keyboard-action (d/nilv keyboard-action action)]
[:a {:on-click action
:class klass
:on-key-down (fn [event]
(when (kbd/enter? event)
(when ^boolean (kbd/enter? event)
(keyboard-action event)))
:tab-index "0"
:data-test data-test}
[:* children]]))
children]))