Compare commits

..

2 Commits

Author SHA1 Message Date
Willem Dantuma
f802f41bbb Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-15 11:34:27 +01:00
Willem Dantuma
d134240b8b Add fm-thumbnail component 2021-02-15 11:34:21 +01:00
4 changed files with 34 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import { MenuBackgroundComponent } from './components/menu-background/menu-backg
import { HasPackageDirective} from './components/has-package/has-package.directive'; import { HasPackageDirective} from './components/has-package/has-package.directive';
import { HasClaimDirective} from './components/has-claim/has-claim.directive'; import { HasClaimDirective} from './components/has-claim/has-claim.directive';
import { UserMenuComponent} from './components/user-menu/user-menu.component'; import { UserMenuComponent} from './components/user-menu/user-menu.component';
import { ThumbnailComponent } from './components/thumbnail/thumbnail.component';
import { Alert } from './enumerations/alert.enum'; import { Alert } from './enumerations/alert.enum';
import { IEventMessage } from './models/event.message'; import { IEventMessage } from './models/event.message';
import { IItem, Item } from './models/item'; import { IItem, Item } from './models/item';
@ -71,6 +72,7 @@ export {
TimespanComponent, TimespanComponent,
TagInputComponent, TagInputComponent,
UserMenuComponent, UserMenuComponent,
ThumbnailComponent,
HasPackageDirective, HasPackageDirective,
HasClaimDirective, HasClaimDirective,
Alert, Alert,
@ -133,7 +135,8 @@ export {
GradientSelectComponent, GradientSelectComponent,
AppMenuComponent, AppMenuComponent,
NotificationMenuComponent, NotificationMenuComponent,
BackButtonComponent BackButtonComponent,
ThumbnailComponent
], ],
exports: [ exports: [
NgbModule, NgbModule,
@ -156,7 +159,8 @@ export {
UserMenuComponent, UserMenuComponent,
GradientComponent, GradientComponent,
GradientSelectComponent, GradientSelectComponent,
BackButtonComponent BackButtonComponent,
ThumbnailComponent
] ]
}) })
export class AppCommonModule { export class AppCommonModule {

View File

@ -0,0 +1,6 @@
<div class="thumbnail">
<img *ngIf="item.thumbnail" class="card-img-top" [src]="getThumbnailUrl(item)" />
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
</div>
</div>

View File

@ -0,0 +1,22 @@
import { Component,Input } from '@angular/core';
import { Store } from '@ngrx/store';
import { IItem } from '../../models/item';
import { commonReducers,ItemTypeService } from '../../../public-api'
@Component({
selector: 'fm-thumbnail',
templateUrl: 'thumbnail.component.html',
styleUrls: ['thumbnail.component.scss']
})
export class ThumbnailComponent {
@Input() public item: IItem;
constructor(public store: Store<commonReducers.State>, public itemTypeService: ItemTypeService) {
}
getThumbnailUrl(item:IItem):string {
return item.url+'/thumbnail?v=' + Date.parse(item.updated);
}
}