aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-04-19 15:48:51 +0200
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-04-19 16:35:54 +0200
commit7de7af4e41fd57b514485efeb804d9efcaaa2cd6 (patch)
tree08601c16cbcc498469fd5abc164bf3e2a3edcce0 /src/frontend
parent73f3442800dcdc955ae97aeaea369d580c9f3c40 (diff)
feat: add scroll-into-view effects
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/tubo/events.cljs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs
index a48a001..a989dcc 100644
--- a/src/frontend/tubo/events.cljs
+++ b/src/frontend/tubo/events.cljs
@@ -68,6 +68,12 @@
(set! (.. js/document.body -style -overflow) (if active "hidden" "auto"))))
(rf/reg-fx
+ ::scroll-into-view!
+ (fn [element]
+ (when element
+ (.scrollIntoView element (js-obj "behavior" "smooth")))))
+
+(rf/reg-fx
::document-title!
(fn [title]
(set! (.-title js/document) (str title " - Tubo"))))
@@ -194,6 +200,11 @@
::body-overflow! (not (:show-media-queue db))}))
(rf/reg-event-fx
+ ::scroll-into-view
+ (fn [{:keys [db]} [_ element]]
+ {::scroll-into-view! element}))
+
+(rf/reg-event-fx
::change-volume-level
[(rf/inject-cofx :store)]
(fn [{:keys [db store]} [_ value player]]