Skip to content

Commit bdf2f7a

Browse files
annieywwagnermaciel
authored andcommitted
docs(material/table): fix table examples (#22792)
(cherry picked from commit 555852e)
1 parent 4a7374f commit bdf2f7a

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

src/components-examples/material/table/table-footer-row/table-footer-row-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Component} from '@angular/core';
22

3-
export interface Transaction {
3+
interface Transaction {
44
item: string;
55
cost: number;
66
}

src/components-examples/material/table/table-http/table-http-example.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ table {
2828
}
2929

3030
.example-rate-limit-reached {
31-
color: #980000;
3231
max-width: 360px;
3332
text-align: center;
3433
}

src/components-examples/material/table/table-multiple-header-footer/table-multiple-header-footer-example.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ table {
1515
}
1616

1717
.example-second-footer-row td {
18-
color: #900000;
18+
font-style: italic;
1919
}

src/components-examples/material/table/table-multiple-header-footer/table-multiple-header-footer-example.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import {Component} from '@angular/core';
2-
import {Transaction} from '../table-footer-row/table-footer-row-example';
2+
3+
interface Transaction {
4+
item: string;
5+
cost: number;
6+
}
7+
38

49
/**
510
* @title Table with multiple header and footer rows

src/components-examples/material/table/table-overview/table-overview-example.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
<td mat-cell *matCellDef="let row"> {{row.name}} </td>
2525
</ng-container>
2626

27-
<!-- Color Column -->
28-
<ng-container matColumnDef="color">
29-
<th mat-header-cell *matHeaderCellDef mat-sort-header> Color </th>
30-
<td mat-cell *matCellDef="let row" [style.color]="row.color"> {{row.color}} </td>
27+
<!-- Fruit Column -->
28+
<ng-container matColumnDef="fruit">
29+
<th mat-header-cell *matHeaderCellDef mat-sort-header> Fruit </th>
30+
<td mat-cell *matCellDef="let row"> {{row.fruit}} </td>
3131
</ng-container>
3232

3333
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
@@ -41,3 +41,4 @@
4141

4242
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator>
4343
</div>
44+

src/components-examples/material/table/table-overview/table-overview-example.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ export interface UserData {
77
id: string;
88
name: string;
99
progress: string;
10-
color: string;
10+
fruit: string;
1111
}
1212

1313
/** Constants used to fill up our data base. */
14-
const COLORS: string[] = [
15-
'maroon', 'red', 'orange', 'yellow', 'olive', 'green', 'purple', 'fuchsia', 'lime', 'teal',
16-
'aqua', 'blue', 'navy', 'black', 'gray'
14+
const FRUITS: string[] = [
15+
'blueberry', 'lychee', 'kiwi', 'mango', 'peach', 'lime', 'pomegranate', 'pineapple'
1716
];
1817
const NAMES: string[] = [
1918
'Maia', 'Asher', 'Olivia', 'Atticus', 'Amelia', 'Jack', 'Charlotte', 'Theodore', 'Isla', 'Oliver',
@@ -29,7 +28,7 @@ const NAMES: string[] = [
2928
templateUrl: 'table-overview-example.html',
3029
})
3130
export class TableOverviewExample implements AfterViewInit {
32-
displayedColumns: string[] = ['id', 'name', 'progress', 'color'];
31+
displayedColumns: string[] = ['id', 'name', 'progress', 'fruit'];
3332
dataSource: MatTableDataSource<UserData>;
3433

3534
@ViewChild(MatPaginator) paginator: MatPaginator;
@@ -61,12 +60,12 @@ export class TableOverviewExample implements AfterViewInit {
6160
/** Builds and returns a new User. */
6261
function createNewUser(id: number): UserData {
6362
const name = NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' +
64-
NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.';
63+
NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.';
6564

6665
return {
6766
id: id.toString(),
6867
name: name,
6968
progress: Math.round(Math.random() * 100).toString(),
70-
color: COLORS[Math.round(Math.random() * (COLORS.length - 1))]
69+
fruit: FRUITS[Math.round(Math.random() * (FRUITS.length - 1))]
7170
};
7271
}

0 commit comments

Comments
 (0)