Skip to content

Commit

Permalink
fix: add back animation to right sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
thezjy authored and tiensonqin committed Apr 17, 2021
1 parent c134aa1 commit 4f88415
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
13 changes: 5 additions & 8 deletions src/main/frontend/components/right_sidebar.cljs
Expand Up @@ -232,15 +232,12 @@
(< right-el-ratio 0.2) 0.2
(> right-el-ratio 0.7) 0.7
:else right-el-ratio)
left-el (js/document.getElementById "left-main")
right-el (js/document.getElementById "right-sidebar")]
(when (and left-el right-el)
(.setProperty (.-style left-el)
"flex"
(str (- 1 right-el-ratio)))
(when right-el

(.setProperty (.-style right-el)
"flex"
(str right-el-ratio)))))}}))
"width"
(str (* right-el-ratio 100) "%")))))}}))
(.styleCursor false)
(.on "dragstart" #(.. js/document.documentElement -classList (add "is-resizing-buf")))
(.on "dragend" #(.. js/document.documentElement -classList (remove "is-resizing-buf")))))
Expand All @@ -261,7 +258,7 @@
t (i18n/use-tongue)]
(rum/with-context [[t] i18n/*tongue-context*]
[:div#right-sidebar.cp__right-sidebar.h-screen.overflow-x-hidden
{:class (if sidebar-open? "is-open")}
{:class (if sidebar-open? "open" "closed")}
(if sidebar-open?
[:div.cp__right-sidebar-inner.flex.flex-col.h-full

Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/components/sidebar.cljs
Expand Up @@ -333,7 +333,7 @@
:close-fn close-fn
:route-match route-match})
[:div.#app-container.h-screen.flex
[[:div.flex-1.h-full.flex.flex-col#left-main {:class (if sidebar-open? "sidebar-open")}
[[:div.flex-1.h-full.flex.flex-col
[(header/header {:open-fn open-fn
:white? white?
:current-repo current-repo
Expand Down
16 changes: 7 additions & 9 deletions src/main/frontend/components/sidebar.css
Expand Up @@ -52,10 +52,6 @@
}
}

#left-main:not(.sidebar-open) {
flex: 1 !important;
}

.settings-modal {
margin: -15px;
}
Expand Down Expand Up @@ -101,15 +97,17 @@
}

.cp__right-sidebar {
display: none;
width: var(--ls-right-sidebar-width);
z-index: var(--ls-z-index-level-1);
transition: width 0.3s, opacity 0.2s;
transition: width 0.3s;
border-radius: var(--ls-border-radius-low) 0 0 0;
background-color: var(--ls-secondary-background-color, #d8e1e8);

&.is-open {
display: block;
&.closed {
width: 0 !important;
}

&.open {
width: var(--ls-right-sidebar-width);
}

&::-webkit-scrollbar {
Expand Down

0 comments on commit 4f88415

Please sign in to comment.