Sidebar redesign

This commit is contained in:
Mojca Lorber 2020-01-24 13:22:04 +01:00
parent 9e4ae525e6
commit f5d245e7cc
7 changed files with 43 additions and 82 deletions

View file

@ -90,6 +90,12 @@
* Setup the sidebar collapsing & expanding functionality. * Setup the sidebar collapsing & expanding functionality.
*/ */
global.setupSidebarTree = function() { global.setupSidebarTree = function() {
$('.tree a').click(function() {
var url = new URL($(this).attr('href'));
url.searchParams.set('scroll', $('.tree').scrollTop());
$(this).attr('href', url.toString());
})
function toggleLi(el, collapse, animate) { function toggleLi(el, collapse, animate) {
var children = el.find(' > ul > li'); var children = el.find(' > ul > li');
@ -265,12 +271,7 @@
} }
function scrollToSelectedItem() { function scrollToSelectedItem() {
var offset; $('#slide-panel .tree').scrollTo($('.tree').data('scroll'));
if ($('#slide-panel .active').length) {
offset = $('#slide-panel .active').offset().top - 50;
if (offset < 0) offset = 0;
$('#slide-panel .tree').scrollTo(offset, 10);
}
} }
// Initialize click listeners // Initialize click listeners

View file

@ -4,25 +4,23 @@
* For details, see http://www.apache.org/licenses/LICENSE-2.0. * For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/ */
@import 'constants'; @import "constants";
@import "mixins"; @import "mixins";
$wrapper-width: 280px; :root {
$toggle-btn-size: 50px; --wrapper-width: 280px;
}
@mixin sidebar-shown { @mixin sidebar-shown {
// This rule is always overriden (show()) in JS // This rule is always overriden (show()) in JS
// after document is loaded // after document is loaded
display: none; display: none;
padding-left: $wrapper-width; padding-left: var(--wrapper-width);
padding-right: 0; padding-right: 0;
-webkit-transition: all 0.5s ease; transition: .4s $timing-function-sharp;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
#sidebar-arrow { #sidebar-arrow {
background-color: $brand-default; background-color: $color-concrete;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
bottom: 50%; bottom: 50%;
@ -53,20 +51,17 @@ $toggle-btn-size: 50px;
} }
#sidebar-wrapper { #sidebar-wrapper {
background-color: $color-white; background-color: $color-concrete;
box-shadow: $flyout-shadow;
height: 100%; height: 100%;
margin-left: -$wrapper-width; left: 83px;
position: fixed; position: fixed;
-moz-transition: 0.4s $timing-function-sharp; transition: .4s $timing-function-sharp;
-o-transition: 0.4s $timing-function-sharp; width: var(--wrapper-width);
-webkit-transition: 0.4s $timing-function-sharp;
transition: 0.4s $timing-function-sharp;
width: $wrapper-width;
z-index: 999; z-index: 999;
#slide-panel { #slide-panel {
height: 100%; height: 100%;
overflow: hidden;
.disabled { .disabled {
opacity: 1; opacity: 1;
@ -81,9 +76,9 @@ $toggle-btn-size: 50px;
opacity: 1; opacity: 1;
overflow-y: auto; overflow-y: auto;
padding: 20px 0; padding: 20px 0;
position: absolute;
// Animations right: 0;
@include transition(opacity 0.5s ease); width: var(--wrapper-width);
} }
} }
} }
@ -93,14 +88,11 @@ $toggle-btn-size: 50px;
padding-left: 0; padding-left: 0;
#sidebar-wrapper { #sidebar-wrapper {
margin-left: 0; left: calc(83px - var(--wrapper-width));
width: 0;
#slide-panel { #slide-panel {
.tree { .tree {
opacity: 0; @include transition(opacity .5s ease);
@include transition(opacity 0.5s ease);
} }
} }
} }
@ -110,9 +102,9 @@ $toggle-btn-size: 50px;
border-left: 1px dotted $color-emperor; border-left: 1px dotted $color-emperor;
bottom: 20px; bottom: 20px;
content: ""; content: "";
left: 34px;
position: absolute; position: absolute;
top: 25px; top: 25px;
left: 34px;
} }
#wrapper { #wrapper {

View file

@ -13,18 +13,12 @@
margin-bottom: 0; margin-bottom: 0;
} }
.no-indent {
background-color: $color-white;
}
.first-indent { .first-indent {
background-color: $color-concrete; margin-left: 30px;
padding-left: 30px;
} }
.second-indent { .second-indent {
background-color: $color-concrete; margin-left: 60px;
padding-left: 60px;
} }
li { li {
@ -49,8 +43,8 @@
} }
&.active > span { &.active > span {
background-color: $brand-primary; background-color: $color-white;
color: $color-white; color: $brand-primary;
font-weight: bold; font-weight: bold;
&.first-indent > span, &.first-indent > span,
@ -77,22 +71,17 @@
// Links are recolored // Links are recolored
a { a {
color: $color-emperor; color: $color-volcano;
position: relative; position: relative;
&.disabled { &.disabled {
color: $color-white; color: $brand-primary;
} }
&:hover { &:hover {
color: $brand-primary; color: $color-volcano;
} }
} }
.border-custom {
box-shadow: 0 -.25px 0 .25px $color-alto;
margin: 0 15px;
}
} }
.tree-link { .tree-link {
@ -121,7 +110,7 @@
} }
.first-indent { .first-indent {
padding-left: 45px; padding-left: 15px;
} }
} }
} }
@ -136,7 +125,7 @@
.active { .active {
.fas-custom { .fas-custom {
fill: $color-white; fill: $brand-primary;
} }
} }
} }

View file

@ -8,27 +8,25 @@
} }
.repository-show { .repository-show {
animation-timing-function: $timing-function-sharp;
height: calc(100vh - 66px); height: calc(100vh - 66px);
left: var(--repository-sidebar-margin); left: var(--repository-sidebar-margin);
margin: 0; margin: 0;
padding: 0 32px; padding: 0 32px;
position: absolute; position: absolute;
top: 51px; top: 51px;
transition: .4s; transition: .4s $timing-function-sharp;
width: calc(100vw - var(--repository-sidebar-margin)); width: calc(100vw - var(--repository-sidebar-margin));
#repository-toolbar { #repository-toolbar {
align-items: center; align-items: center;
animation-timing-function: $timing-function-sharp;
background-color: $color-white; background-color: $color-white;
display: flex; display: flex;
height: 75px; height: 75px;
left: var(--repository-sidebar-margin); left: var(--repository-sidebar-margin);
padding: 35px 32px 20px; padding: 35px 32px 20px;
position: fixed; position: fixed;
transition: .4s; transition: .4s $timing-function-sharp;
width: calc(100% - var(--repository-sidebar-margin)); width: calc(100% - var(--repository-sidebar-margin));
z-index: 100; z-index: 100;
@ -93,7 +91,6 @@
.main-actions { .main-actions {
align-items: center; align-items: center;
animation-timing-function: $timing-function-sharp;
background-color: $color-white; background-color: $color-white;
display: flex; display: flex;
flex-grow: 1; flex-grow: 1;
@ -102,7 +99,7 @@
padding: 0 32px; padding: 0 32px;
position: fixed; position: fixed;
top: 126px; top: 126px;
transition: .4s; transition: .4s $timing-function-sharp;
width: calc(100% - var(--repository-sidebar-margin)); width: calc(100% - var(--repository-sidebar-margin));
z-index: 90; z-index: 90;
@ -121,9 +118,8 @@
z-index: 90; z-index: 90;
.table.dataTable { .table.dataTable {
animation-timing-function: $timing-function-sharp;
margin-top: 0 !important; margin-top: 0 !important;
transition: .4s; transition: .4s $timing-function-sharp;
th { th {
transition: width .2s; transition: width .2s;
@ -140,7 +136,6 @@
.pagination-row { .pagination-row {
align-items: center; align-items: center;
animation-timing-function: $timing-function-sharp;
background-color: $color-white; background-color: $color-white;
bottom: 0; bottom: 0;
display: flex; display: flex;
@ -148,7 +143,7 @@
left: var(--repository-sidebar-margin); left: var(--repository-sidebar-margin);
padding: 0 142px 0 32px; padding: 0 142px 0 32px;
position: fixed; position: fixed;
transition: .4s; transition: .4s $timing-function-sharp;
width: calc(100% - var(--repository-sidebar-margin)); width: calc(100% - var(--repository-sidebar-margin));
z-index: 90; z-index: 90;
@ -181,14 +176,6 @@
} }
} }
.repositories-dropdown-menu { .repositories-dropdown-menu {
border: 1px solid $color-gainsboro; border: 1px solid $color-gainsboro;
border-top: 0; border-top: 0;
@ -470,4 +457,3 @@
color: $color-silver-chalice; color: $color-silver-chalice;
} }
} }

View file

@ -86,5 +86,5 @@
} }
.all-teams-navigation-link { .all-teams-navigation-link {
color: $color-white !important; color: $brand-primary !important;
} }

View file

@ -284,7 +284,6 @@ a[data-toggle="tooltip"] {
} }
.navbar-secondary { .navbar-secondary {
background: $color-concrete !important;
margin-left: -280px; margin-left: -280px;
padding-left: 280px; padding-left: 280px;
padding-right: 82px; padding-right: 82px;
@ -393,19 +392,13 @@ a[data-toggle="tooltip"] {
} }
.navbar-secondary { .navbar-secondary {
-webkit-transition: all 0.5s ease; transition: .4s $timing-function-sharp;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
} }
.navbar-without-sidebar{ .navbar-without-sidebar{
margin-left: 0px; margin-left: 0px;
padding-left: 0; padding-left: 0;
-o-transition: all 0.5s ease; transition: .4s $timing-function-sharp;
-moz-transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;
} }
/** Chat bubble */ /** Chat bubble */

View file

@ -9,7 +9,7 @@
data-current-project="<%= current_project&.id %>" data-current-project="<%= current_project&.id %>"
data-current-experiment="<%= current_experiment&.id %>" data-current-experiment="<%= current_experiment&.id %>"
data-current-task="<%= current_task&.id %>"> data-current-task="<%= current_task&.id %>">
<div class="tree"> <div class="tree perfect-scrollbar" data-scroll="<%= params[:scroll] %>">
<ul> <ul>
<% cache [action_name, current_user, current_team] do %> <% cache [action_name, current_user, current_team] do %>
<%= render partial: 'shared/sidebar/projects' %> <%= render partial: 'shared/sidebar/projects' %>