Skip to content

Commit cd8b7ab

Browse files
benelliottjelbourn
authored andcommittedSep 5, 2018
feat: add summaries to all menu items and category pages (#512)
1 parent 2604ba7 commit cd8b7ab

File tree

8 files changed

+296
-59
lines changed

8 files changed

+296
-59
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
<div class="docs-component-category-list-summary">{{_categoryListSummary}}</div>
12
<div class="docs-component-category-list">
23
<a *ngFor="let category of docItems.getCategories((params | async)?.section)"
34
class="docs-component-category-list-item"
45
[routerLink]="['../', category.id]">
56
<mat-card class="docs-component-category-list-card">
67
<mat-card-title>{{category.name}}</mat-card-title>
8+
<mat-card-content class="docs-component-category-list-card-summary">{{category.summary}}</mat-card-content>
79
</mat-card>
810
</a>
911
</div>

‎material.angular.io/src/app/pages/component-category-list/component-category-list.scss

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
@import '../../../styles/constants';
22

3+
.docs-component-category-list-summary {
4+
padding: 25px 40px 0;
5+
}
6+
37
.docs-component-category-list {
48
display: flex;
59
flex-wrap: wrap;

‎material.angular.io/src/app/pages/component-category-list/component-category-list.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {Observable, combineLatest, Subscription} from 'rxjs';
1616
export class ComponentCategoryList implements OnInit, OnDestroy {
1717
params: Observable<Params>;
1818
routeParamSubscription: Subscription;
19+
_categoryListSummary: string;
1920

2021
constructor(public docItems: DocumentationItems,
2122
public _componentPageTitle: ComponentPageTitle,
@@ -30,7 +31,9 @@ export class ComponentCategoryList implements OnInit, OnDestroy {
3031
// title on topbar navigation
3132
this.routeParamSubscription = this.params.subscribe(params => {
3233
const sectionName = params['section'];
33-
this._componentPageTitle.title = SECTIONS[sectionName];
34+
const section = SECTIONS[sectionName];
35+
this._componentPageTitle.title = section.name;
36+
this._categoryListSummary = section.summary;
3437
});
3538
}
3639

‎material.angular.io/src/app/pages/component-list/_component-list-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
$background: map-get($theme, background);
66
$foreground: map-get($theme, foreground);
77

8-
.docs-component-list-item {
8+
.docs-component-list-card-summary {
99
color: mat-color($foreground, secondary-text);
1010
}
1111
}

‎material.angular.io/src/app/pages/component-list/component-list.html

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
<a *ngFor="let component of category.items"
33
class="docs-component-list-item"
44
[routerLink]="'/' + section + '/' + component.id">
5-
<mat-card class="docs-component-list-card">
6-
<mat-card-title class="docs-component-list-card-title">{{component.name}}</mat-card-title>
7-
<div class="docs-component-list-icon-spacer"></div>
8-
<div class="docs-component-list-item-icon">
9-
<docs-svg-viewer
5+
<mat-card>
6+
<mat-card-header class="docs-component-list-card-header">
7+
<mat-card-title class="docs-component-list-card-title">{{component.name}}</mat-card-title>
8+
<div class="docs-component-list-icon-spacer"></div>
9+
<div class="docs-component-list-item-icon">
10+
<docs-svg-viewer
1011
[attr.aria-label]="component.name"
1112
scaleToContainer="true"
1213
[src]="'../../../assets/img/components/' + component.id + '.svg'"></docs-svg-viewer>
13-
</div>
14+
</div>
15+
</mat-card-header>
16+
<mat-card-content class="docs-component-list-card-summary" *ngIf="component.summary">
17+
{{component.summary}}
18+
</mat-card-content>
1419
</mat-card>
1520
</a>
1621
</div>

‎material.angular.io/src/app/pages/component-list/component-list.scss

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,18 @@
3030
}
3131

3232
.docs-component-list-card-title {
33-
margin: 0;
33+
margin: 0 0 0 -8px;
3434
}
3535

36-
.docs-component-list-card {
37-
display: flex;
36+
.docs-component-list-card-header {
3837
align-items: center;
3938
}
4039

40+
.docs-component-list-card-summary {
41+
min-height: 2.4em;
42+
margin-top: 20px;
43+
}
44+
4145
.docs-component-list-item-icon {
4246
margin: 0 0 0 10px;
4347
width: 40px;

‎material.angular.io/src/app/shared/documentation-items/documentation-items.ts

+265-46
Large diffs are not rendered by default.

‎material.angular.io/src/app/shared/navbar/navbar.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</a>
99
<a mat-button class="docs-navbar-hide-small docs-button"
1010
*ngFor="let key of sectionKeys"
11-
[routerLink]="key">{{sections[key]}}</a>
11+
[routerLink]="key">{{sections[key].name}}</a>
1212
<a mat-button class="docs-navbar-hide-small docs-button" routerLink="guides">Guides</a>
1313
<div class="flex-spacer"></div>
1414
<version-picker></version-picker>
@@ -30,6 +30,6 @@
3030
<nav class="docs-navbar docs-navbar-show-small">
3131
<a mat-button class="docs-navbar-link"
3232
*ngFor="let key of sectionKeys"
33-
[routerLink]="key">{{sections[key]}}</a>
33+
[routerLink]="key">{{sections[key].name}}</a>
3434
<a mat-button class="docs-navbar-link" routerLink="guides">Guides</a>
3535
</nav>

0 commit comments

Comments
 (0)
Please sign in to comment.