feat: use school-neutral news image fallback via css

This commit is contained in:
Jovan Krunić
2021-01-30 16:28:50 +01:00
parent 1f3d9ad5f0
commit bb94c71761
4 changed files with 32 additions and 5 deletions

View File

@@ -1,11 +1,17 @@
<ion-card> <ion-card>
<span *ngIf="item.url; else imageNoUrl"> <span *ngIf="item.url; else imageNoUrl">
<a href="{{item.url}}"> <a href="{{item.url}}">
<img src="{{item.image}}" onError="this.src='../../assets/imgs/modules/news/placeholder.jpg';" /> <ion-thumbnail>
<img src="{{item.image}}" onerror="this.style.display = 'none'" />
<ion-icon name="newspaper-outline"></ion-icon>
</ion-thumbnail>
</a> </a>
</span> </span>
<ng-template #imageNoUrl> <ng-template #imageNoUrl>
<img src="{{item.image}}" onError="this.src='../../assets/imgs/modules/news/placeholder.jpg';" /> <ion-thumbnail>
<img src="{{item.image}}" onerror="this.style.display = 'none'" />
<ion-icon name="newspaper-outline"></ion-icon>
</ion-thumbnail>
</ng-template> </ng-template>
<ion-card-header> <ion-card-header>
<ion-card-subtitle *ngIf="item.datePublished">{{item.datePublished | amLocale: language | amDateFormat:'Do MMMM YYYY, HH:mm'}} <ion-card-subtitle *ngIf="item.datePublished">{{item.datePublished | amLocale: language | amDateFormat:'Do MMMM YYYY, HH:mm'}}

View File

@@ -7,6 +7,24 @@ ion-card-header a {
padding-left: 4px; padding-left: 4px;
} }
} }
ion-card img { ion-card ion-thumbnail img {
width: 100%; width: 100%;
z-index: 1;
position: absolute;
}
ion-card ion-thumbnail {
position: relative;
background: var(--placeholder-gray);
width: 100%;
min-height: 400px;
align-items: center;
margin: 0;
ion-icon {
position: absolute;
width: 100%;
height: 100%;
color: white;
display: block;
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -74,4 +74,7 @@
--ion-color-dark-contrast-rgb: 255,255,255; --ion-color-dark-contrast-rgb: 255,255,255;
--ion-color-dark-shade: #1e1e1e; --ion-color-dark-shade: #1e1e1e;
--ion-color-dark-tint: #383838; --ion-color-dark-tint: #383838;
/** StApps **/
--placeholder-gray: #F1F0ED;
} }