body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; } section.sidebar { width: 320px; background-color: #f8f9fa; border-left: 1px solid #cdcdcd; border-right: 1px solid #cdcdcd; } // ---------------------------------------------------------------------------------- $text-color: #1f1f1f; $border-color: #cdcdcd; $subnav-indent: 10px; $icon-width: 50px; $level-one-indent: $icon-width; $border-img: url("../img/border.png"); $dot-img: url("../img/dot.png"); $expand-arrow-height: 18px; $border-width: 20px; $border-margin-right: 15px; @mixin variable-left-border-connector($indent) { :not(:last-of-type) li { position: relative; &::before { content: " "; width: $border-width; height: 100%; position: absolute; top: 0; left: $indent; margin-right: $border-margin-right; background-image: $border-img; background-repeat: repeat-y; background-position: top center; } } } @mixin reset-single-item-background($li-background-image) { &:first-of-type:last-of-type { &::before { background-image: $li-background-image; } > a { &::before { background-image: $dot-img; } } } } nav.main { li { border-bottom: 1px solid $border-color; &:first-of-type { border-top: 1px solid $border-color; } > a { display: block; padding: 15px 0; text-decoration: none; color: $text-color; &:hover { background-color: rgba($text-color, 0.03); } } } ul { list-style-type: none; padding: 0; margin: 0; } // level 0: main items > ul > li { a.icon { position: relative; padding-left: $icon-width; display: flex; align-items: center; // main icons &::before { content: ""; position: absolute; top: 0; left: 0; width: $icon-width; height: 100%; background-position: center center; background-size: 22px 22px; background-repeat: no-repeat; filter: opacity(69%); // make icons transparent (black -> grayish) } &.icon-dashboard::before { background-image: url("/img/menu-icons/dashboard.svg"); } &.icon-machines::before { background-image: url("/img/menu-icons/machines.svg"); } &.icon-events::before { background-image: url("/img/menu-icons/events.svg"); } &.icon-reports::before { background-image: url("/img/menu-icons/reports.svg"); } &.icon-call-center::before { background-image: url("/img/menu-icons/call-center.svg"); } &.icon-warehouse-management::before { background-image: url("/img/menu-icons/dashboard.svg"); } &::after { content: ""; margin-left: auto; width: $expand-arrow-height / 2; height: $expand-arrow-height; margin-right: 10px; background-repeat: no-repeat; background-image: url("/img/menu-icons/menu-arrow.svg"); transition: transform 0.3s; transform-origin: 50% 50%; } &.collapsable:not(.collapsed) { &::after { transform: rotate(90deg); } } } } // subnav level 1 ul.subnav { border-top: 1px solid $border-color; li { // reset parent borders border-bottom: none; &:first-of-type { border-top: none; } a { padding-left: $level-one-indent; position: relative; &::before { content: " "; width: $border-width; height: 100%; position: absolute; top: 0; left: $subnav-indent; margin-right: $border-margin-right; background-image: $border-img; background-repeat: no-repeat; background-position: top center; } } // first item: dot + line down &:first-of-type { > a { &::before { background-image: $border-img, $dot-img; top: 20px; // hardcoded! } } } // last item: dot + line up &:last-of-type { > a { &::before { background-image: $border-img, $dot-img; background-position: bottom; top: -20px; // hardcoded! } } } @include reset-single-item-background(none); @include variable-left-border-connector($subnav-indent * 4); // subnav level 2 > ul { li { a { padding-left: $subnav-indent * 7; &::before { left: $subnav-indent * 4; } } @include reset-single-item-background($border-img); @include variable-left-border-connector($subnav-indent * 7); // subnav level 3 > ul li { a { padding-left: $subnav-indent * 10; &::before { left: $subnav-indent * 7; } } @include reset-single-item-background($border-img); @include variable-left-border-connector($subnav-indent * 10); // subnav level 4 > ul li a { padding-left: $subnav-indent * 13; &::before { left: $subnav-indent * 10; } } } } } } @include variable-left-border-connector($subnav-indent * 1); } }