mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
enhance(ux): better highlights page name for the search result items
This commit is contained in:
7
deps/shui/src/logseq/shui/list_item/v1.cljs
vendored
7
deps/shui/src/logseq/shui/list_item/v1.cljs
vendored
@@ -41,7 +41,7 @@
|
||||
[:span normal-text])))))
|
||||
|
||||
(rum/defc root [{:keys [icon icon-theme query text info shortcut value-label value
|
||||
title highlighted on-highlight on-highlight-dep header on-click
|
||||
title highlighted on-highlight on-highlight-dep header on-click hls-page?
|
||||
hoverable compact rounded on-mouse-enter component-opts source-page] :as _props
|
||||
:or {hoverable true rounded true}}
|
||||
{:keys [app-config] :as context}]
|
||||
@@ -93,8 +93,9 @@
|
||||
(if (and (= icon "page") (not= text source-page)) ;; alias
|
||||
[:div.flex.flex-row.items-center.gap-2
|
||||
(highlight-query text)
|
||||
[:div.opacity-50.font-normal "alias of"]
|
||||
source-page]
|
||||
(if-not hls-page?
|
||||
[:<> [:div.opacity-50.font-normal "alias of"] source-page]
|
||||
[:div.opacity-50.font-normal.text-xs " — Highlights page"])]
|
||||
(highlight-query text))
|
||||
(when info
|
||||
[:span.text-xs.text-gray-11 " — " (highlight-query info)])]]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[frontend.components.block :as block]
|
||||
[frontend.extensions.pdf.utils :as pdf-utils]
|
||||
[frontend.context.i18n :refer [t]]
|
||||
[frontend.db :as db]
|
||||
[frontend.db.model :as model]
|
||||
@@ -604,9 +605,15 @@
|
||||
|
||||
[:div.search-results
|
||||
(for [item visible-items
|
||||
:let [highlighted? (= item highlighted-item)]]
|
||||
:let [highlighted? (= item highlighted-item)
|
||||
page? (= "page" (some-> item :icon))
|
||||
text (some-> item :text)
|
||||
source-page (some-> item :source-page)
|
||||
hls-page? (and page? (pdf-utils/hls-file? source-page))]]
|
||||
(let [item (shui/list-item (assoc item
|
||||
:query (when-not (= group :create) @(::input state))
|
||||
:text (if hls-page? (pdf-utils/fix-local-asset-pagename text) text)
|
||||
:hls-page? hls-page?
|
||||
:compact true
|
||||
:rounded false
|
||||
:hoverable @*mouse-active?
|
||||
|
||||
Reference in New Issue
Block a user