forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat(nav): new sidenav UX (angular#300)"
This reverts commit f1ddeae.
- Loading branch information
Showing
10 changed files
with
109 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 19 additions & 32 deletions
51
src/app/pages/component-sidenav/_component-sidenav-theme.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<mat-sidenav-container class="docs-component-viewer-sidenav-container"> | ||
<!-- If on small screen, menu resides in drawer --> | ||
<mat-sidenav #sidenav class="docs-component-viewer-sidenav" | ||
*ngIf="isScreenSmall()" | ||
[opened]="!isScreenSmall()" | ||
[mode]="isScreenSmall() ? 'over' : 'side'"> | ||
<app-component-nav [params]="params"></app-component-nav> | ||
<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> | ||
</mat-sidenav> | ||
|
||
<div class="docs-component-sidenav-content"> | ||
<component-page-header (toggleSidenav)="sidenav.toggle()"></component-page-header> | ||
<div class="docs-component-sidenav-inner-content"> | ||
<div class="docs-component-sidenav-body-content"> | ||
<!-- If on large screen, menu resides to left of content --> | ||
<app-component-nav | ||
*ngIf="!isScreenSmall()" | ||
[params]="params"> | ||
</app-component-nav> | ||
<router-outlet></router-outlet> | ||
</div> | ||
<app-footer></app-footer> | ||
</div> | ||
<router-outlet></router-outlet> | ||
<app-footer></app-footer> | ||
</div> | ||
</mat-sidenav-container> | ||
</mat-sidenav-container> |
177 changes: 58 additions & 119 deletions
177
src/app/pages/component-sidenav/component-sidenav.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,149 +1,88 @@ | ||
@import '../../../styles/constants'; | ||
|
||
$sidenav-spacing-unit: 8px; | ||
$sidenav-width: 240px; | ||
|
||
app-component-sidenav { | ||
display: flex; | ||
} | ||
|
||
.docs-component-viewer-sidenav-container { | ||
box-sizing: border-box; | ||
width: 100%; | ||
|
||
.mat-drawer-content { | ||
position: absolute; | ||
right: 0; | ||
left: 0; | ||
} | ||
} | ||
|
||
.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%; | ||
|
||
.docs-component-sidenav-inner-content { | ||
display: flex; | ||
flex-direction: row; | ||
&.mat-sidenav-opened { | ||
box-shadow: 3px 0 6px rgba(0, 0, 0, .24); | ||
} | ||
|
||
// The rule will match the element following the router-outlet which will be the routed component. | ||
router-outlet + * { | ||
flex-grow: 1; | ||
// 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); | ||
} | ||
} | ||
|
||
.mat-drawer { | ||
&::-webkit-scrollbar { | ||
height: 4px; | ||
width: 4px; | ||
ul { | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
} | ||
|
||
.docs-component-viewer-nav { | ||
position: sticky; | ||
top: 25px; | ||
// Sidenav navigation item | ||
li { | ||
border-bottom-width: 1px; | ||
border-bottom-style: solid; | ||
margin: 0; | ||
padding: 0; | ||
|
||
.docs-component-viewer-nav-content { | ||
margin: 25px; | ||
width: $sidenav-width; | ||
max-height: 75vh; | ||
overflow: auto; | ||
|
||
&::-webkit-scrollbar { | ||
height: 4px; | ||
width: 4px; | ||
// Hide the border on the last item | ||
&:last-child { | ||
border-color: transparent; | ||
} | ||
|
||
button { | ||
padding: 10px 15px; | ||
font-weight: 700; | ||
line-height: 16px; | ||
margin: 0; | ||
font-size: 13px; | ||
cursor: pointer; | ||
position: relative; | ||
> a { | ||
box-sizing: border-box; | ||
display: block; | ||
width: 100%; | ||
text-align: left; | ||
background: none; | ||
border: none; | ||
|
||
&:focus { | ||
outline: none; | ||
} | ||
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); | ||
position: relative; | ||
|
||
.mat-icon { | ||
position: absolute; | ||
right: 5px; | ||
font-size: 18px; | ||
&.docs-component-viewer-sidenav-item-selected { | ||
font-weight: 600; | ||
} | ||
} | ||
|
||
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 { | ||
display: block; | ||
text-decoration: none; | ||
} | ||
} | ||
} | ||
|
||
.docs-component-sidenav-content { | ||
min-height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
// Add specific rule to prevent default rule conflict | ||
.docs-component-viewer-sidenav-container.mat-drawer-container{ | ||
display: block; | ||
overflow: hidden; | ||
position: absolute; | ||
// Offset the top by the toolbar height | ||
top: 50px; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.docs-component-sidenav-inner-content { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.docs-component-sidenav-body-content { | ||
display: flex; | ||
// footer should always reside at the bottom of the screen. | ||
// if container not 100vh, push min height to that minus | ||
// the offset of the top bar and the footer height | ||
min-height: calc(100vh - 264px); | ||
} | ||
|
||
@media (max-width: $small-breakpoint-width) { | ||
// Add specific rule to prevent default rule conflict | ||
.docs-component-viewer-sidenav-container .docs-component-viewer-sidenav { | ||
// offset the top by the header + tabs on a small screen | ||
top: 42px; | ||
} | ||
|
||
.mat-sidenav-content { | ||
// offset the top by the header + tabs on a small screen | ||
margin-top: 42px; | ||
} | ||
|
||
.docs-component-viewer-nav { | ||
position: relative; | ||
top: 0; | ||
|
||
.docs-component-viewer-nav-content { | ||
box-sizing: border-box; | ||
margin: 0; | ||
max-height: initial; | ||
box-sizing: border-box; | ||
} | ||
// The rule will match the element following the router-outlet which will be the routed component. | ||
router-outlet + * { | ||
flex-grow: 1; | ||
} | ||
} |
Oops, something went wrong.