Просмотр исходного кода

enhance(ui): polish shortcuts component

charlie 2 лет назад
Родитель
Сommit
c6aa3a98dd

+ 0 - 2
deps/shui/src/logseq/shui/core.cljs

@@ -12,11 +12,9 @@
 
 ;; shortcut
 (def shortcut shui.shortcut.v1/root)
-(def shortcut-v1 shui.shortcut.v1/root)
 
 ;; icon
 (def icon shui.icon.v2/root)
-(def icon-v2 shui.icon.v2/root)
 
 ;; list-item
 (def list-item shui.list-item.v1/root)

+ 7 - 4
deps/shui/src/logseq/shui/shortcut/v1.cljs

@@ -63,10 +63,13 @@
 
 (rum/defc part
   [ks size]
-  (let [tiles (map print-shortcut-key ks)]
-    (ui/button {:variant     :default
-                :class       "bg-gray-03 text-gray-12 px-1.5 py-0 leading-4 h-5 hover:bg-gray-04 active:bg-gray-03 hover:text-gray-11"
-                :interactive false
+  (let [tiles (map print-shortcut-key ks)
+        interactive? false]
+    (ui/button {:variant     :text
+                :class       (str "bg-gray-03 text-gray-10 px-1.5 py-0 leading-4 h-5 "
+                               (if interactive?
+                                 "hover:bg-gray-04 active:bg-gray-03 hover:text-gray-11"
+                                 "cursor-default hover:bg-gray-03 active:bg-gray-03 hover:text-gray-11"))
                 :size        size}
       (for [[index tile] (map-indexed vector tiles)]
         [:<>

+ 1 - 1
src/main/frontend/components/shortcut.cljs

@@ -475,5 +475,5 @@
 
                         (not unset?)
                         [:code.flex.items-center.bg-transparent
-                         (shui/shortcut-v1 (string/join " | " (map #(dh/binding-for-display id %) binding))
+                         (shui/shortcut (string/join " | " (map #(dh/binding-for-display id %) binding))
                            nil {:size :md})])]]))))])])]]))

+ 1 - 1
src/main/frontend/ui.cljs

@@ -177,7 +177,7 @@
                        (string/split #" "))
                    sequence)]
     [:span.keyboard-shortcut
-     (shui/shortcut-v1 sequence opts)]))
+     (shui/shortcut sequence opts)]))
 
 (rum/defc menu-link
   [{:keys [only-child? no-padding? class shortcut] :as options} child]