feat: new layout for sidebar

This commit is contained in:
Junyu Zhan
2021-04-09 18:08:31 +08:00
committed by Tienson Qin
parent 2f948f5e60
commit 9fe925f9fc
4 changed files with 45 additions and 86 deletions

View File

@@ -104,10 +104,10 @@
[:div.flex-1.h-0.overflow-y-auto
(sidebar-nav route-match close-fn)]]])
(rum/defc sidebar-main
(rum/defc main
[{:keys [route-match global-graph-pages? logged? home? route-name indexeddb-support? white? db-restoring? main-content]}]
(rum/with-context [[t] i18n/*tongue-context*]
[:div#main-content.cp__sidebar-main-layout
[:div#main-content.cp__sidebar-main-layout.flex-1.overflow-y-auto.flex
[:div#sidebar-nav-wrapper.flex-col.pt-4.hidden.sm:block
{:style {:flex (if (state/get-left-sidebar-open?)
"0 1 20%"
@@ -116,7 +116,7 @@
(if white? "#f0f8ff" "#073642"))}}
(when (state/sub :ui/left-sidebar-open?)
(sidebar-nav route-match nil))]
[:div#main-content-container.cp__sidebar-main-content-container
[:div#main-content-container.w-full.flex.justify-center
[:div.cp__sidebar-main-content
{:data-is-global-graph-pages global-graph-pages?
:data-is-full-width (or global-graph-pages?
@@ -133,8 +133,7 @@
:else
[:div {:class (if global-graph-pages? "" (util/hiccup->class "max-w-7xl.mx-auto"))
:style {:margin-bottom (if global-graph-pages? 0 120)}}
main-content])]]
(right-sidebar/sidebar)]))
main-content])]]]))
(defn get-default-home-if-valid
[]
@@ -229,7 +228,7 @@
:exit 300}}
links
;; (custom-context-menu-content)
))))
))))
(rum/defc new-block-mode < rum/reactive
[]
@@ -333,28 +332,29 @@
{:open? open?
:close-fn close-fn
:route-match route-match})
[:div.#app-container.cp__sidebar-layout
{:class (if sidebar-open? "is-right-sidebar-open")
:style {:padding-bottom (if global-graph-pages? 0 30)}}
(header/header {:open-fn open-fn
:white? white?
:current-repo current-repo
:logged? logged?
:page? page?
:route-match route-match
:me me
:default-home default-home
:new-block-mode new-block-mode})
[:div.#app-container.h-screen.flex
[[:div.w-full.h-full.flex.flex-col
[(header/header {:open-fn open-fn
:white? white?
:current-repo current-repo
:logged? logged?
:page? page?
:route-match route-match
:me me
:default-home default-home
:new-block-mode new-block-mode})
(main {:route-match route-match
:global-graph-pages? global-graph-pages?
:logged? logged?
:home? home?
:route-name route-name
:indexeddb-support? indexeddb-support?
:white? white?
:db-restoring? db-restoring?
:main-content main-content})]]
(right-sidebar/sidebar)]]
(sidebar-main {:route-match route-match
:global-graph-pages? global-graph-pages?
:logged? logged?
:home? home?
:route-name route-name
:indexeddb-support? indexeddb-support?
:white? white?
:db-restoring? db-restoring?
:main-content main-content})]
(ui/notification)
(ui/modal)
@@ -371,4 +371,4 @@
;; :on-click (fn []
;; (state/set-left-sidebar-open! (not (state/get-left-sidebar-open?))))}
;; (if (state/sub :ui/left-sidebar-open?) "<" ">")]
)]))))
)]))))