Skip to content

Commit

Permalink
feat: make right sidebar toggle button visible no matter open or close
Browse files Browse the repository at this point in the history
  • Loading branch information
thezjy authored and tiensonqin committed Apr 17, 2021
1 parent 35dfae5 commit 252cc1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/main/frontend/components/header.cljs
Expand Up @@ -15,6 +15,7 @@
[frontend.components.repo :as repo]
[frontend.components.search :as search]
[frontend.components.export :as export]
[frontend.components.right-sidebar :as sidebar]
[frontend.handler.project :as project-handler]
[frontend.handler.page :as page-handler]
[frontend.handler.web.nfs :as nfs]
Expand Down Expand Up @@ -213,6 +214,4 @@
:t t
:current-repo current-repo
:default-home default-home})

[:a.close-arrow.opacity-50.hover:opacity-100.ml-4 {:on-click state/toggle-sidebar-open?!}
(svg/big-arrow-right)]])))
(when (not (state/sub :ui/sidebar-open?)) (sidebar/toggle))])))
11 changes: 9 additions & 2 deletions src/main/frontend/components/right_sidebar.cljs
Expand Up @@ -25,6 +25,11 @@
[frontend.db-mixins :as db-mixins]
[frontend.config :as config]))

(rum/defc toggle
[]
[:a.opacity-50.hover:opacity-100.ml-4 {:on-click state/toggle-sidebar-open?!}
(svg/menu)])

(rum/defc block-cp < rum/reactive
[repo idx block]
(let [id (:block/uuid block)]
Expand Down Expand Up @@ -263,7 +268,7 @@
[:div.cp__right-sidebar-inner.flex.flex-col.h-full

(sidebar-resizer)
[:div.flex.flex-row.justify-between.items-center.px-4
[:div.flex.flex-row.justify-between.items-center.px-4.h-12
[:div.cp__right-sidebar-settings.hide-scrollbar {:key "right-sidebar-settings"}
[:div.ml-4.text-sm
[:a.cp__right-sidebar-settings-btn {:on-click (fn [e]
Expand All @@ -289,7 +294,9 @@
[:div.ml-4.text-sm
[:a.cp__right-sidebar-settings-btn {:on-click (fn [_e]
(state/sidebar-add-block! repo "help" :help nil))}
(t :right-side-bar/help)]]]]
(t :right-side-bar/help)]]]

(when sidebar-open? (toggle))]
[:.sidebar-item-list.overflow-y-auto.flex-1
(for [[idx [repo db-id block-type block-data]] (medley/indexed blocks)]
(rum/with-key
Expand Down
4 changes: 0 additions & 4 deletions src/main/frontend/components/sidebar.css
Expand Up @@ -141,10 +141,6 @@
}
}

.close-arrow svg {
transform: scale(0.8);
}

.page {
margin-top: 0;
}
Expand Down

0 comments on commit 252cc1b

Please sign in to comment.