Add fm-thumbnail component
This commit is contained in:
parent
3f6863845b
commit
d134240b8b
@ -33,6 +33,7 @@ import { MenuBackgroundComponent } from './components/menu-background/menu-backg
|
||||
import { HasPackageDirective} from './components/has-package/has-package.directive';
|
||||
import { HasClaimDirective} from './components/has-claim/has-claim.directive';
|
||||
import { UserMenuComponent} from './components/user-menu/user-menu.component';
|
||||
import { ThumbnailComponent } from './components/thumbnail/thumbnail.component';
|
||||
import { Alert } from './enumerations/alert.enum';
|
||||
import { IEventMessage } from './models/event.message';
|
||||
import { IItem, Item } from './models/item';
|
||||
@ -71,6 +72,7 @@ export {
|
||||
TimespanComponent,
|
||||
TagInputComponent,
|
||||
UserMenuComponent,
|
||||
ThumbnailComponent,
|
||||
HasPackageDirective,
|
||||
HasClaimDirective,
|
||||
Alert,
|
||||
@ -133,7 +135,8 @@ export {
|
||||
GradientSelectComponent,
|
||||
AppMenuComponent,
|
||||
NotificationMenuComponent,
|
||||
BackButtonComponent
|
||||
BackButtonComponent,
|
||||
ThumbnailComponent
|
||||
],
|
||||
exports: [
|
||||
NgbModule,
|
||||
@ -156,7 +159,8 @@ export {
|
||||
UserMenuComponent,
|
||||
GradientComponent,
|
||||
GradientSelectComponent,
|
||||
BackButtonComponent
|
||||
BackButtonComponent,
|
||||
ThumbnailComponent
|
||||
]
|
||||
})
|
||||
export class AppCommonModule {
|
||||
|
@ -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>
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user