Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table View for Data Offers #369

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,40 +1,70 @@
<mat-card *ngFor="let dataOffer of dataOffers" class="asset-card">
<ng-container *ngIf="dataOffer.asset; let asset">
<mat-card-header>
<icon-with-online-status
mat-card-avatar
mainIcon="sim_card"
[onlineStatus]="dataOffer.connectorOnlineStatus">
</icon-with-online-status>
<mat-card-title>
<a
class="link"
href="javascript:void(0)"
(click)="dataOfferClick.emit(dataOffer)">
{{ asset.name }}
</a>
</mat-card-title>
<mat-card-subtitle>{{ asset.originatorOrganization }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content class="flex flex-col space-y-[16px]">
<!-- Description -->
<div
*ngIf="asset.description"
class="whitespace-pre-line truncate-lines-5">
{{ asset.description }}
</div>

<!-- Tag List -->
<div *ngIf="asset.keywords.length || asset.version">
<mat-chip-list aria-label="Tags">
<mat-chip *ngIf="asset.version" color="primary" selected>{{
asset.version
}}</mat-chip>
<mat-chip *ngFor="let keyword of asset.keywords">{{
keyword
}}</mat-chip>
</mat-chip-list>
</div>
</mat-card-content>
</ng-container>
</mat-card>
<table class="table align-middle mb-0 bg-white">
<thead class="bg-light">
<tr>
<th>Status</th>
<th>Title</th>
<th>Organization</th>
<th>Version</th>
<th>Keywords</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let dataOffer of dataOffers" class="asset-card">
<ng-container *ngIf="dataOffer.asset; let asset">
<td>
<div class="d-flex align-items-center">
<icon-with-online-status
mainIcon="sim_card"
[onlineStatus]="dataOffer.connectorOnlineStatus">
</icon-with-online-status>
</div>
</td>
<td>
<div class="ms-3">
<p class="fw-bold mb-1">
<a
class="link"
href="javascript:void(0)"
(click)="dataOfferClick.emit(dataOffer)">
{{ asset.name }}
</a>
</p>
</div>
</td>
<td>{{ asset.originatorOrganization }}</td>
<td>
<div
*ngIf="asset.keywords.length || asset.version"
style="display: inline-flex; justify-content: center">
<mat-chip-list aria-label="Tags">
<mat-chip *ngIf="asset.version" color="primary" selected>{{
asset.version
}}</mat-chip>
</mat-chip-list>
</div>
</td>
<td>
<div
*ngIf="asset.keywords.length || asset.version"
style="display: inline-flex; justify-content: center">
<mat-chip-list aria-label="Tags">
<mat-chip *ngFor="let keyword of asset.keywords">{{
keyword
}}</mat-chip>
</mat-chip-list>
</div>
</td>
<td>
<button
class="btn btn-link btn-sm btn-rounded"
type="button"
href="javascript:void(0)"
(click)="dataOfferClick.emit(dataOffer)">
Details
</button>
</td>
</ng-container>
</tr>
</tbody>
</table>
51 changes: 51 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,54 @@ body {
flex-direction: column;
overflow-x: hidden !important;
}

.table {
width: 100%;
table-layout: fixed;
}

.table td {
table-layout: fixed;
border: 1px solid #ddd;
padding: 8px;
text-align: center;
vertical-align: middle;
align-items: center;
justify-content: center;
}

.table th {
border: 1px solid #ddd;
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
background-color: #ddd;
vertical-align: middle;
}

.table th:nth-child(1),
.table td:nth-child(1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table cells don't need to be resized. The size hint on the table headers should be sufficient.

width: 10%;
}
.table th:nth-child(2),
.table td:nth-child(2) {
width: 20%;
}
.table th:nth-child(3),
.table td:nth-child(3) {
width: 20%;
}
.table th:nth-child(4),
.table td:nth-child(4) {
width: 10%;
text-align: center;
}
.table th:nth-child(5),
.table td:nth-child(5) {
width: 30%;
text-align: center;
}
.table th:nth-child(6),
.table td:nth-child(6) {
width: 10%;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use tailwind classes for such simple styles. All the above classes should be unnecessary

e.g. <table class="w-full table-fixed">
e.g. <th class="w-[30%] text-center">

Loading