-
Notifications
You must be signed in to change notification settings - Fork 395
feat(nav): new sidenav #300
Changes from 3 commits
544fba9
1866432
add0fd3
5d1f851
8ce095c
38a02a2
bac53e8
0af56d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="docs-component-viewer-nav"> | ||
<div class="docs-component-viewer-nav-inner"> | ||
<nav *ngFor="let category of docItems.getCategories((params | async)?.section); let last = last;"> | ||
<h3 (click)="toggleExpand(category.id)"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a11y, each of these sections needs to act like an expansion panel. This means that the thing you interact with should be a |
||
{{category.name}} | ||
<mat-icon *ngIf="!getExpanded(category.id)">keyboard_arrow_down</mat-icon> | ||
<mat-icon *ngIf="getExpanded(category.id)">keyboard_arrow_up</mat-icon> | ||
</h3> | ||
<ul [@bodyExpansion]="_getExpandedState(category.id)"> | ||
<li *ngFor="let component of category.items"> | ||
<a [routerLink]="'/' + (params | async)?.section+ '/' + component.id" | ||
routerLinkActive="docs-component-viewer-sidenav-item-selected"> | ||
{{component.name}} | ||
</a> | ||
</li> | ||
</ul> | ||
<hr *ngIf="!last" /> | ||
</nav> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<mat-sidenav-container class="docs-component-viewer-sidenav-container"> | ||
<mat-sidenav #sidenav class="docs-component-viewer-sidenav" | ||
*ngIf="isScreenSmall()" | ||
[opened]="!isScreenSmall()" | ||
[mode]="isScreenSmall() ? 'over' : 'side'"> | ||
<nav *ngFor="let category of docItems.getCategories((params | async)?.section)"> | ||
<h3>{{category.name}}</h3> | ||
<ul> | ||
<li *ngFor="let component of category.items"> | ||
<a [routerLink]="'/' + (params | async)?.section+ '/' + component.id" | ||
routerLinkActive="docs-component-viewer-sidenav-item-selected"> | ||
{{component.name}} | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
<app-component-nav | ||
[params]="params"> | ||
</app-component-nav> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like it could fit on one line |
||
</mat-sidenav> | ||
|
||
<div class="docs-component-sidenav-content"> | ||
<component-page-header (toggleSidenav)="sidenav.toggle()"></component-page-header> | ||
<router-outlet></router-outlet> | ||
<app-footer></app-footer> | ||
<div class="docs-component-sidenav-inner-content"> | ||
<div class="docs-component-sidenav-body-content"> | ||
<app-component-nav | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment explaining the different structure based on screen size? |
||
*ngIf="!isScreenSmall()" | ||
[params]="params"> | ||
</app-component-nav> | ||
<router-outlet></router-outlet> | ||
</div> | ||
<app-footer></app-footer> | ||
</div> | ||
</div> | ||
</mat-sidenav-container> | ||
</mat-sidenav-container> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,133 @@ | ||
$sidenav-spacing-unit: 8px; | ||
$sidenav-width: 240px; | ||
@import '../../../styles/constants'; | ||
|
||
app-component-sidenav { | ||
display: flex; | ||
} | ||
$sidenav-width: 240px; | ||
|
||
.docs-component-viewer-sidenav-container { | ||
width: 100%; | ||
|
||
.mat-drawer-content { | ||
position: absolute; | ||
right: 0; | ||
left: 0; | ||
} | ||
box-sizing: border-box; | ||
} | ||
|
||
.docs-component-viewer-sidenav { | ||
box-shadow: 3px 0 6px rgba(0, 0, 0, .24); | ||
padding-bottom: 72px; | ||
width: $sidenav-width; | ||
bottom: 0; | ||
overflow: auto; | ||
height: 100%; | ||
} | ||
|
||
&.mat-sidenav-opened { | ||
box-shadow: 3px 0 6px rgba(0, 0, 0, .24); | ||
} | ||
.docs-component-sidenav-inner-content { | ||
display: flex; | ||
flex-direction: row; | ||
|
||
// Section divider | ||
h3 { | ||
border: none; | ||
font-size: 10px; | ||
letter-spacing: 1px; | ||
line-height: $sidenav-spacing-unit * 3; | ||
text-transform: uppercase; | ||
font-weight: 400; | ||
margin: 0; | ||
padding: 0 ($sidenav-spacing-unit * 2); | ||
// The rule will match the element following the router-outlet which will be the routed component. | ||
router-outlet + * { | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
.mat-drawer { | ||
&::-webkit-scrollbar { | ||
height: 4px; | ||
width: 4px; | ||
} | ||
} | ||
|
||
// Sidenav navigation item | ||
li { | ||
border-bottom-width: 1px; | ||
border-bottom-style: solid; | ||
margin: 0; | ||
padding: 0; | ||
.docs-component-viewer-nav { | ||
position: sticky; | ||
top: 25px; | ||
|
||
.docs-component-viewer-nav-inner { | ||
margin: 25px; | ||
width: $sidenav-width; | ||
max-height: 75vh; | ||
overflow: auto; | ||
|
||
// Hide the border on the last item | ||
&:last-child { | ||
border-color: transparent; | ||
&::-webkit-scrollbar { | ||
height: 4px; | ||
width: 4px; | ||
} | ||
|
||
> a { | ||
box-sizing: border-box; | ||
display: block; | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: ($sidenav-spacing-unit * 6) - 1; | ||
text-decoration: none; | ||
transition: all .3s; | ||
padding: 0 ($sidenav-spacing-unit * 2); | ||
h3 { | ||
padding: 10px 15px; | ||
font-weight: 700; | ||
line-height: 16px; | ||
margin: 0; | ||
font-size: 13px; | ||
cursor: pointer; | ||
position: relative; | ||
|
||
&.docs-component-viewer-sidenav-item-selected { | ||
font-weight: 600; | ||
.mat-icon { | ||
position: absolute; | ||
right: 5px; | ||
font-size: 18px; | ||
} | ||
} | ||
|
||
hr { | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
margin: -5px 0 5px 0; | ||
padding: 0; | ||
overflow: hidden; | ||
} | ||
|
||
li { | ||
font-size: 13px; | ||
line-height: 16px; | ||
margin: 0; | ||
padding: 5px 15px 5px 20px; | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
} | ||
} | ||
} | ||
|
||
.docs-component-sidenav-content { | ||
min-height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
// The rule will match the element following the router-outlet which will be the routed component. | ||
router-outlet + * { | ||
flex-grow: 1; | ||
// Add specific rule to prevent default rule conflict | ||
.docs-component-viewer-sidenav-container.mat-drawer-container{ | ||
display: block; | ||
overflow: hidden; | ||
position: absolute; | ||
top: 50px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment for |
||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.docs-component-sidenav-inner-content { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.docs-component-sidenav-body-content { | ||
display: flex; | ||
min-height: calc(100vh - 264px); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is 264? It looks based on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 264 is the footer + header nav height. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah lol of course the min-height doesn't have anything to do with sidenav width. Maybe add it as a variable with a comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment for sure at the least |
||
} | ||
|
||
@media (max-width: $small-breakpoint-width) { | ||
// Add specific rule to prevent default rule conflict | ||
.docs-component-viewer-sidenav-container .docs-component-viewer-sidenav { | ||
top: 42px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment for |
||
} | ||
|
||
.mat-sidenav-content { | ||
margin-top: 42px; | ||
} | ||
|
||
.docs-component-viewer-nav { | ||
position: relative; | ||
top: 0; | ||
|
||
.docs-component-viewer-nav-inner { | ||
box-sizing: border-box; | ||
margin: 0; | ||
max-height: initial; | ||
box-sizing: border-box; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more descriptive name than
inner
, or a comment you could add to explain what the element is?