Enhance shortcut rendering in CMD K component

- Updated shortcut rendering logic to conditionally apply styles based on the presence of modifier keys, improving visual clarity.
- Refined the display of shortcuts in tooltips for better user experience and accessibility.
This commit is contained in:
scheinriese
2025-11-29 04:27:56 +01:00
parent bcc68452f2
commit ff8efe42b1

View File

@@ -908,7 +908,7 @@
(shui/shortcut "/")
[:div "to filter search results"]]
[:div.flex.flex-row.gap-1.items-center.opacity-50.hover:opacity-100
(shui/shortcut ["mod" "enter"])
(shui/shortcut ["mod" "enter"] {:style :combo})
[:div "to open search in the sidebar"]]]))
(rum/defcs tip <
@@ -936,9 +936,16 @@
[[:span.opacity-60 text]
;; shortcut
(when (not-empty shortcut)
(shui/shortcut shortcut {:style :separate
:interactive? false
:aria-hidden? true}))]))
(let [has-modifier? (and (coll? shortcut)
(some #(#{"shift" "ctrl" "alt" "cmd" "mod" "⌘" "⌥" "⌃"}
(string/lower-case (str %)))
shortcut))
style (if (and (> (count shortcut) 1) has-modifier?)
:combo
:auto)]
(shui/shortcut shortcut {:style style
:interactive? false
:aria-hidden? true})))]))
(rum/defc hints
[state]