Skip to content

Commit e8d78f6

Browse files
committed
feat: optional indentation in sidebar-nav
1 parent e781dfd commit e8d78f6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

scss/_sidebar.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,32 @@
370370
}
371371
}
372372

373+
374+
.c-sidebar-nav[data-indentation="true"] {
375+
$wrapper-class-name: ".c-sidebar-nav-dropdown-items";
376+
@for $i from 1 through $sidebar-nav-indentation-levels {
377+
#{$wrapper-class-name} {
378+
.c-sidebar-nav-link {
379+
@include ltr {
380+
padding-left: $sidebar-nav-icon-width + ($i * $sidebar-nav-indentation-size);
381+
}
382+
@include rtl {
383+
padding-right: $sidebar-nav-icon-width + ($i * $sidebar-nav-indentation-size);
384+
}
385+
.c-sidebar-nav-icon {
386+
@include ltr {
387+
margin-left: - $sidebar-nav-icon-width;
388+
}
389+
@include rtl {
390+
margin-right: - $sidebar-nav-icon-width;
391+
}
392+
}
393+
}
394+
}
395+
$wrapper-class-name: selector-nest($wrapper-class-name, $wrapper-class-name);
396+
}
397+
}
398+
373399
.c-sidebar-nav-label {
374400
display: flex;
375401
padding: ($sidebar-nav-link-padding-y / 4) $sidebar-nav-link-padding-x;

scss/variables/components/_sidebar.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ $sidebar-nav-link-padding-y: .8445rem !default;
7171
$sidebar-nav-link-padding-x: 1rem !default;
7272
$sidebar-nav-icon-width: 56px !default;
7373

74+
$sidebar-nav-indentation-levels: 5 !default;
75+
$sidebar-nav-indentation-size: 8px !default;
76+
7477
$sidebar-dark-nav-title-color: rgba($white, .6) !default;
7578
$sidebar-dark-nav-link-color: rgba($white, .8) !default;
7679
$sidebar-dark-nav-link-bg: transparent !default;

0 commit comments

Comments
 (0)