-
Notifications
You must be signed in to change notification settings - Fork 395
Conversation
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.
Very excited for this!
$background: map-get($theme, background); | ||
$foreground: map-get($theme, foreground); | ||
$sidenav: '.docs-component-viewer-sidenav'; | ||
$is-dark-theme: map-get($theme, is-dark); | ||
$nav-background-color: if($is-dark-theme, 0.2, 0.03); |
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.
$nav-background-opacity
?
</a> | ||
</li> | ||
</ul> | ||
<hr *ngIf="docItems.getCategories((params | async)?.section).length !== (i + 1)" /> |
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.
How about using last
so you don't have to sub twice,
<nav *ngFor="let category of docItems.getCategories((params | async)?.section); let last = last;">
<!-- ... -->
<hr *ngIf="!last" />
</nav>
@@ -2,25 +2,20 @@ | |||
|
|||
app-component-viewer { | |||
font-weight: 400; | |||
padding: 20px $content-padding-side 50px; | |||
padding: 20px 50px 50px 20px; |
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.
Maybe add a comment? Better yet, I see 20px, 25px, 50px coming up a lot. Could they be added to _constants.scss
?
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.
I did a search and didn't find any other cases, can you point me to the other usages?
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.
I may have said that prematurely. I'll take a look when I get a chance to run it locally. Or I'll try to add sass constants throughout the app in a later PR.
private _router: Router) { } | ||
|
||
ngOnInit() { | ||
this._router.events.subscribe(() => this.setExpansions()); |
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.
Won't this create a ton of never-completing subscriptions? How about,
ngOnInit() {
this._router.events
.switchMap(() => this.params)
.takeUntil(this._onDestroy)
.subscribe(p => this.setExpansions(p));
}
ngOnDestroy() {
this._onDestroy.next();
this._onDestroy.complete();
}
setExpansions(p: Params) {
// ...
}
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.
You're right. Thanks for the suggestion!!
|
||
.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 comment
The reason will be displayed to describe this comment to others. Learn more.
What is 264? It looks based on $sidenav-width
somehow.
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.
264 is the footer + header nav height.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Comment for sure at the least
setExpansions() { | ||
this.params.subscribe(p => { | ||
const categories = this.docItems.getCategories(p.section); | ||
for (const category of categories) { |
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.
As a followup of a previous comment, this should be,
setExpansions(p: Params) {
const categories = this.docItems.getCategories(p.section);
for (...) {
// ...
}
}
so that it doesn't create another subscription. That also means that ngOnInit
should updated like,
ngOnInit() {
this._router.events
.switchMap(() => this.params)
.takeUntil(this._onDestroy)
.subscribe(p => this.setExpansions(p));
}
If there is a problem that _router.events
doesn't fire immediately, you could do this,
ngOnInit() {
this._router.events
.startWith(null)
.switchMap(() => this.params)
.takeUntil(this._onDestroy)
.subscribe(p => this.setExpansions(p));
}
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.
Beautiful and done.
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.
- Should the page have a minimum height so that it doesn't shrink when all of the sections are collapsed?
- Any thoughts on adding an expand-all?
- The click target for the links in the nav should stretch the entire width of the container
|
||
.docs-component-viewer-nav-inner { |
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?
<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 comment
The 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 <button>
(with the same aria attrs that expansion panel uses). We shouldn't need to use a real heading element here since it's not part of the document content (table of contents).
</nav> | ||
<app-component-nav | ||
[params]="params"> | ||
</app-component-nav> |
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.
This looks like it could fit on one line
<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 comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment explaining the different structure based on screen size?
display: block; | ||
overflow: hidden; | ||
position: absolute; | ||
top: 50px; |
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.
Comment for 50px
?
|
||
.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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Comment for 42px
?
@@ -1,12 +1,14 @@ | |||
:host { | |||
font-size: 13px; | |||
width: 15%; | |||
width: 19%; |
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.
Comment?
this._onDestroy.complete(); | ||
} | ||
|
||
setExpansions(params: Params) { |
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.
JsDoc for methods?
That is handled by the 100vh calc above.
I haven't seen any other pages on Google have this, open to it if you have an idea how to.
done. |
package.json
Outdated
@@ -4,7 +4,7 @@ | |||
"license": "MIT", | |||
"angular-cli": {}, | |||
"scripts": { | |||
"start": "npm run build-themes && ng serve --aot --sourcemaps=false", |
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.
--aot
Want to add another command like start-jit
that is set up that way?
<div class="docs-component-viewer-nav"> | ||
<div class="docs-component-viewer-nav-content"> | ||
<nav *ngFor="let category of docItems.getCategories((params | async)?.section); let last = last;"> | ||
<button (click)="toggleExpand(category.id)"> |
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.
- Add an
aria-label
like "Expand the {{category.name}} section of navigation links" - Add
aria-controls
pointing to the element that expands - Add
aria-expanded
@jelbourn - done :) |
<div class="docs-component-viewer-nav-content"> | ||
<nav *ngFor="let category of docItems.getCategories((params | async)?.section); let last = last;"> | ||
<button (click)="toggleExpand(category.id)" | ||
[attr.aria-label]="'Expand the ' + category.name" |
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.
I tried this out with VoiceOver. The label would be easier to understand as:
category.name + ', section toggle
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.
Done :)
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.
LGTM
@amcdnl can you re-create this PR? I reverted it b/c it conflicts with a change Miles was working on that will change the structure of the sidenav first |
This reverts commit f1ddeae.
@mmalerba - let me know when your ready for me to cut a new PR. |
@amcdnl my change is merged now |
Done. See #310 |
Implements new sidenav.