mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 20:26:37 +02:00
24 lines
786 B
Clojure
24 lines
786 B
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS INC
|
|
|
|
(ns app.main.ui.components.link
|
|
(:require
|
|
[app.common.data :as d]
|
|
[app.util.keyboard :as kbd]
|
|
[rumext.v2 :as mf]))
|
|
|
|
(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 ^boolean (kbd/enter? event)
|
|
(keyboard-action event)))
|
|
:tab-index "0"
|
|
:data-test data-test}
|
|
children]))
|