enhance: show more/less only in the section that's selected

pull/10493/head
Tienson Qin 2023-11-08 20:48:09 +08:00
parent 05da1618b6
commit 1a260f6240
1 changed files with 4 additions and 1 deletions

View File

@ -409,6 +409,7 @@
[state title group visible-items first-item]
(let [{:keys [show items]} (some-> state ::results deref group)
highlighted-item (or @(::highlighted-item state) first-item)
highlighted-group @(::highlighted-group state)
filter @(::filter state)
can-show-less? (< GROUP-LIMIT (count visible-items))
can-show-more? (< (count visible-items) (count items))
@ -427,7 +428,9 @@
[:div {:class "flex-1"}]
(when (and (or can-show-more? can-show-less?) (empty? filter))
(when (and (= group highlighted-group)
(or can-show-more? can-show-less?)
(empty? filter))
[:a.text-link.select-node.opacity-50.hover:opacity-90
{:on-click (if (= show :more) show-less show-more)}
(if (= show :more)