浏览代码

fix: two header links not working

due to recent component refactor
Gabriel Horner 1 年之前
父节点
当前提交
e9ea5c1419
共有 1 个文件被更改,包括 16 次插入9 次删除
  1. 16 9
      src/main/frontend/components/header.cljs

+ 16 - 9
src/main/frontend/components/header.cljs

@@ -194,18 +194,25 @@
                   (shui/popup-show! (.-target e)
                     (fn [{:keys [id]}]
                       (for [{:keys [hr item title options icon]} (items)]
-                        (let [on-click' (:on-click options)]
+                        (let [on-click' (:on-click options)
+                              href (:href options)]
                           (if hr
                             (shui/dropdown-menu-separator)
                             (shui/dropdown-menu-item
-                              (assoc options
-                                :on-click (fn [^js e]
-                                            (when on-click'
-                                              (when-not (false? (on-click' e))
-                                                (shui/popup-hide! id)))))
-                              (or item
-                                [:span.flex.items-center.gap-1.w-full
-                                 icon [:div title]]))))))
+                             (assoc options
+                                    :on-click (fn [^js e]
+                                                (when on-click'
+                                                  (when-not (false? (on-click' e))
+                                                    (shui/popup-hide! id)))))
+                             (or item
+                                 (if href
+                                   [:a.flex.items-center.w-full
+                                    {:href href :on-click #(shui/popup-hide! id)
+                                     :style {:color "inherit"}}
+                                    [:span.flex.items-center.gap-1.w-full
+                                     icon [:div title]]]
+                                   [:span.flex.items-center.gap-1.w-full
+                                    icon [:div title]])))))))
                     {:align "end"
                      :as-dropdown? true
                      :content-props {:class "w-64"