Files
logseq/src/main/frontend/components/bottom_bar.cljs
2023-04-12 20:37:52 +08:00

26 lines
994 B
Clojure

(ns frontend.components.bottom-bar
"Bottom bar for editor's status, the general rule is to avoid using this
to present user a simple and clean UI."
(:require [frontend.ui :as ui]
[frontend.state :as state]
[rum.core :as rum]
[frontend.db :as db]
[frontend.modules.editor.undo-redo :as undo-redo]))
(rum/defc bar < rum/reactive
[]
(let [page-only-mode? (state/sub :history/page-only-mode?)
undo-page-id (state/sub :history/page)]
(prn "render bar " {:page-only-mode? page-only-mode?
:undo-page-id undo-page-id})
(when (or (and page-only-mode? undo-page-id)
;; others
)
[:div#ls-bottom-bar
[:div.items
(when undo-page-id
[:div.item.flex.items-center
(str "Undo: " (:block/original-name (db/entity undo-page-id)))
[:a.inline-flex.ml-1 {:on-click undo-redo/toggle-undo-redo-mode!}
(ui/icon "x")]])]])))