Feature/improve styling of benchmarks (#1131)
* Harmonize benchmark table styling * Update changelog
This commit is contained in:
parent
4ccabde251
commit
f127e7c61a
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Simplified the initialization of the exchange rate service
|
- Simplified the initialization of the exchange rate service
|
||||||
|
- Improved the styling of the benchmarks in the markets overview
|
||||||
|
|
||||||
## 1.177.0 - 04.08.2022
|
## 1.177.0 - 04.08.2022
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
<ngx-skeleton-loader
|
<ngx-skeleton-loader
|
||||||
*ngIf="isLoading"
|
*ngIf="isLoading"
|
||||||
animation="pulse"
|
animation="pulse"
|
||||||
|
class="px-2 py-3"
|
||||||
[theme]="{
|
[theme]="{
|
||||||
height: '1.5rem',
|
height: '1.5rem',
|
||||||
width: '100%'
|
width: '100%'
|
||||||
|
@ -1,50 +1,50 @@
|
|||||||
<table class="gf-table w-100">
|
<table class="gf-table w-100" mat-table [dataSource]="benchmarks">
|
||||||
<thead>
|
<ng-container matColumnDef="name">
|
||||||
<tr class="mat-header-row">
|
<th *matHeaderCellDef class="px-2" i18n mat-header-cell>Index</th>
|
||||||
<th class="mat-header-cell px-1 py-2" i18n>Index</th>
|
<td *matCellDef="let element" class="px-2" mat-cell>
|
||||||
<th class="mat-header-cell px-1 py-2 text-right">
|
{{ element?.name }}
|
||||||
<span class="d-none d-sm-block text-nowrap" i18n
|
</td>
|
||||||
>Change from All Time High</span
|
</ng-container>
|
||||||
>
|
|
||||||
<span class="d-block d-sm-none text-nowrap" i18n>from ATH</span>
|
<ng-container matColumnDef="change">
|
||||||
</th>
|
<th *matHeaderCellDef class="text-right" mat-header-cell>
|
||||||
<th class="mat-header-cell px-1 py-2 text-right" i18n></th>
|
<span class="d-none d-sm-block text-nowrap" i18n
|
||||||
</tr>
|
>Change from All Time High</span
|
||||||
</thead>
|
>
|
||||||
<tbody>
|
<span class="d-block d-sm-none text-nowrap" i18n>from ATH</span>
|
||||||
<tr *ngFor="let benchmark of benchmarks" class="mat-row">
|
</th>
|
||||||
<td class="mat-cell px-1 py-2">
|
<td *matCellDef="let element" class="text-right" mat-cell>
|
||||||
<div class="d-flex align-items-center">
|
<gf-value
|
||||||
{{ benchmark.name }}
|
class="d-inline-block justify-content-end"
|
||||||
</div>
|
size="medium"
|
||||||
</td>
|
[isPercent]="true"
|
||||||
<td class="mat-cell px-1 py-2 text-right">
|
[locale]="locale"
|
||||||
<gf-value
|
[ngClass]="{
|
||||||
class="d-inline-block justify-content-end"
|
'text-danger':
|
||||||
size="medium"
|
element?.performances?.allTimeHigh?.performancePercent < 0,
|
||||||
[isPercent]="true"
|
'text-success':
|
||||||
[locale]="locale"
|
element?.performances?.allTimeHigh?.performancePercent > 0
|
||||||
[ngClass]="{
|
}"
|
||||||
'text-danger':
|
[value]="
|
||||||
benchmark?.performances?.allTimeHigh?.performancePercent < 0,
|
element?.performances?.allTimeHigh?.performancePercent ?? undefined
|
||||||
'text-success':
|
"
|
||||||
benchmark?.performances?.allTimeHigh?.performancePercent > 0
|
></gf-value>
|
||||||
}"
|
</td>
|
||||||
[value]="
|
</ng-container>
|
||||||
benchmark?.performances?.allTimeHigh?.performancePercent ??
|
|
||||||
undefined
|
<ng-container matColumnDef="marketCondition">
|
||||||
"
|
<th *matHeaderCellDef mat-header-cell></th>
|
||||||
></gf-value>
|
<td *matCellDef="let element" class="px-0" mat-cell>
|
||||||
</td>
|
<div
|
||||||
<td class="mat-cell px-1 py-2">
|
*ngIf="element?.marketCondition"
|
||||||
<div
|
class="text-center"
|
||||||
*ngIf="benchmark?.marketCondition"
|
[title]="element?.marketCondition"
|
||||||
class="text-center"
|
>
|
||||||
[title]="benchmark?.marketCondition"
|
{{ resolveMarketCondition(element.marketCondition).emoji }}
|
||||||
>
|
</div>
|
||||||
{{ resolveMarketCondition(benchmark.marketCondition).emoji }}
|
</td>
|
||||||
</div>
|
</ng-container>
|
||||||
</td>
|
|
||||||
</tr>
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
</tbody>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -18,6 +18,7 @@ export class BenchmarkComponent implements OnChanges {
|
|||||||
@Input() benchmarks: Benchmark[];
|
@Input() benchmarks: Benchmark[];
|
||||||
@Input() locale: string;
|
@Input() locale: string;
|
||||||
|
|
||||||
|
public displayedColumns = ['name', 'change', 'marketCondition'];
|
||||||
public resolveMarketCondition = resolveMarketCondition;
|
public resolveMarketCondition = resolveMarketCondition;
|
||||||
|
|
||||||
public constructor() {}
|
public constructor() {}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||||
|
import { MatTableModule } from '@angular/material/table';
|
||||||
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
||||||
|
|
||||||
import { GfValueModule } from '../value';
|
import { GfValueModule } from '../value';
|
||||||
@ -8,7 +9,12 @@ import { BenchmarkComponent } from './benchmark.component';
|
|||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [BenchmarkComponent],
|
declarations: [BenchmarkComponent],
|
||||||
exports: [BenchmarkComponent],
|
exports: [BenchmarkComponent],
|
||||||
imports: [CommonModule, GfValueModule, NgxSkeletonLoaderModule],
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
GfValueModule,
|
||||||
|
MatTableModule,
|
||||||
|
NgxSkeletonLoaderModule
|
||||||
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
})
|
})
|
||||||
export class GfBenchmarkModule {}
|
export class GfBenchmarkModule {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user