Skip to content

Commit

Permalink
enhance: add close button to quit highlight recent blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Dec 2, 2024
1 parent 8b8fd87 commit 82ea473
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 24 deletions.
5 changes: 3 additions & 2 deletions src/main/frontend/components/block.css
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,7 @@ html.is-mac {
}
}

.recent-block .bullet-container .bullet {
border: 2px solid;
.recent-block {
transition: background-color 0.2s cubic-bezier(0, 1, 0, 1);
background-color: var(--ls-secondary-background-color, var(--rx-gray-03));
}
53 changes: 31 additions & 22 deletions src/main/frontend/components/header.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -278,28 +278,37 @@
(doseq [node old-nodes]
(d/remove-class! node "recent-block")))))
[recent-days])
(shui/slider
{:class "relative flex w-full touch-none select-none items-center w-[30%]"
:default-value #js [3 100]
:on-value-change (fn [result]
(set-recent-days! (first result))
(state/set-highlight-recent-days! (first result)))
:minStepsBetweenThumbs 1}
(shui/slider-track
{:class "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary"})
(shui/tooltip-provider
(shui/tooltip
(shui/tooltip-trigger
{:as-child true
:on-click (fn [e] (.preventDefault e))}
(shui/slider-thumb
{:ref set-thumb-ref!
:class "block h-4 w-4 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none"}))
(shui/tooltip-content
{:onPointerDownOutside (fn [e] (.preventDefault e))}
(str "Highlight recent blocks"
(when (not= recent-days 0)
(str ": " recent-days " days ago")))))))))
[:div.flex.flex-row.gap-1.items-center
{:class "w-[32%]"}
(shui/slider
{:class "relative flex w-full touch-none select-none items-center "
:default-value #js [3 100]
:on-value-change (fn [result]
(set-recent-days! (first result))
(state/set-highlight-recent-days! (first result)))
:minStepsBetweenThumbs 1}
(shui/slider-track
{:class "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary"})
(shui/tooltip-provider
(shui/tooltip
(shui/tooltip-trigger
{:as-child true
:on-click (fn [e] (.preventDefault e))}
(shui/slider-thumb
{:ref set-thumb-ref!
:class "block h-4 w-4 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none"}))
(shui/tooltip-content
{:onPointerDownOutside (fn [e] (.preventDefault e))}
(str "Highlight recent blocks"
(when (not= recent-days 0)
(str ": " recent-days " days ago")))))))
(shui/button
{:variant :ghost
:size :sm
:title "Quit highlight recent blocks"
:class "opacity-50 hover:opacity-100"
:on-click (fn [] (state/toggle-highlight-recent-blocks!))}
(ui/icon "x" {:size 16}))]))

(rum/defc recent-slider < rum/reactive
{:will-update (fn [state]
Expand Down

0 comments on commit 82ea473

Please sign in to comment.