2015-12-21 00:34:20 +03:00
|
|
|
'use strict';
|
2016-08-28 21:46:10 +03:00
|
|
|
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
|
2016-08-22 12:12:13 +03:00
|
|
|
import { BaseComponent, SpecManager } from '../base';
|
2015-12-21 00:34:20 +03:00
|
|
|
|
2016-08-22 12:12:13 +03:00
|
|
|
@Component({
|
2015-12-21 00:34:20 +03:00
|
|
|
selector: 'api-logo',
|
2016-05-25 18:34:31 +03:00
|
|
|
styleUrls: ['./api-logo.css'],
|
2016-08-22 12:12:13 +03:00
|
|
|
templateUrl: './api-logo.html',
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
2015-12-21 00:34:20 +03:00
|
|
|
})
|
2016-08-28 21:46:10 +03:00
|
|
|
export class ApiLogo extends BaseComponent implements OnInit {
|
2016-07-20 11:07:08 +03:00
|
|
|
logo:any = {};
|
2016-06-13 20:54:24 +03:00
|
|
|
|
2016-06-23 17:36:38 +03:00
|
|
|
constructor(specMgr:SpecManager) {
|
|
|
|
super(specMgr);
|
2015-12-21 00:34:20 +03:00
|
|
|
}
|
|
|
|
|
2016-07-20 11:07:08 +03:00
|
|
|
init() {
|
2015-12-21 00:34:20 +03:00
|
|
|
let logoInfo = this.componentSchema.info['x-logo'];
|
2017-08-16 19:42:25 +03:00
|
|
|
if ('url' in this.componentSchema.info['contact']) {
|
|
|
|
this.logo.url = this.componentSchema.info['contact']['url'];
|
|
|
|
}
|
2015-12-21 00:34:20 +03:00
|
|
|
if (!logoInfo) return;
|
2016-07-20 11:07:08 +03:00
|
|
|
this.logo.imgUrl = logoInfo.url;
|
|
|
|
this.logo.bgColor = logoInfo.backgroundColor || 'transparent';
|
2015-12-21 00:34:20 +03:00
|
|
|
}
|
2016-08-28 21:46:10 +03:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.preinit();
|
|
|
|
}
|
2015-12-21 00:34:20 +03:00
|
|
|
}
|