Improve table layout

pull/1/head
Max Ehrlicher-Schmidt 4 years ago
parent 790ce54cef
commit 411dc3a8e6

@ -1,8 +1,9 @@
<div class="table-page-wrapper">
<div class="table-control"> <div class="table-control">
<button mat-raised-button color="primary">Primary</button> <button mat-raised-button color="primary">Primary</button>
<button mat-raised-button color="accent">Accent</button> <button mat-raised-button color="accent">Accent</button>
</div> </div>
<div id="table-container"> <div class="table-container">
<table <table
mat-table mat-table
[dataSource]="bikes" [dataSource]="bikes"
@ -35,7 +36,7 @@
</ng-container> </ng-container>
<!-- Name Column --> <!-- Name Column -->
<ng-container matColumnDef="name"> <ng-container matColumnDef="name" sticky>
<th mat-header-cell *matHeaderCellDef>Name</th> <th mat-header-cell *matHeaderCellDef>Name</th>
<td <td
mat-cell mat-cell
@ -67,14 +68,23 @@
<!-- NumberOfChildren Column --> <!-- NumberOfChildren Column -->
<ng-container matColumnDef="numberOfChildren"> <ng-container matColumnDef="numberOfChildren">
<th mat-header-cell cdkDrag *matHeaderCellDef>Anzahl Kinder</th> <th mat-header-cell cdkDrag *matHeaderCellDef>Anzahl Kinder</th>
<td mat-cell *matCellDef="let element">{{ element.numberOfChildren }}</td> <td mat-cell *matCellDef="let element">
{{ element.numberOfChildren }}
</td>
</ng-container> </ng-container>
<!-- Buttons Column --> <!-- Buttons Column -->
<ng-container matColumnDef="buttons" stickyEnd> <ng-container matColumnDef="buttons" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th> <th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<mat-icon>more_vert</mat-icon> <div class="button-wrapper">
<button mat-icon-button>
<mat-icon>edit</mat-icon>
</button>
<button mat-icon-button>
<mat-icon>delete</mat-icon>
</button>
</div>
</td> </td>
</ng-container> </ng-container>
@ -83,3 +93,4 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table> </table>
</div> </div>
</div>

@ -1,24 +1,29 @@
.table-page-wrapper {
display: flex;
flex-direction: column;
height: 100%;
.table-control { .table-control {
margin: 0.5em; margin: 0.5em;
flex: none;
} }
#table-container { .table-container {
flex: 1;
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
overflow: auto; overflow: auto;
table { table {
width: 100%; width: 100%;
th.mat-column-name, .mat-header-cell,
td.mat-column-name { .mat-footer-cell,
padding-left: 8px; .mat-cell {
min-width: 80px;
box-sizing: border-box;
} }
.mat-table-sticky:first-child { .button-wrapper {
border-right: 1px solid #ffffff1f; display: flex;
padding-right: 1em; flex-direction: row;
} }
.mat-table-sticky:last-child {
border-left: 1px solid #ffffff1f;
} }
} }
} }

Loading…
Cancel
Save