redoc/lib/components/ApiLogo/api-logo.ts

31 lines
776 B
TypeScript
Raw Normal View History

'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';
2016-08-22 12:12:13 +03:00
@Component({
selector: 'api-logo',
styleUrls: ['./api-logo.css'],
2016-08-22 12:12:13 +03:00
templateUrl: './api-logo.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
2016-08-28 21:46:10 +03:00
export class ApiLogo extends BaseComponent implements OnInit {
logo:any = {};
2016-06-13 20:54:24 +03:00
constructor(specMgr:SpecManager) {
super(specMgr);
}
init() {
const info = this.componentSchema.info;
const logoInfo = info['x-logo'];
if (!logoInfo) return;
this.logo.imgUrl = logoInfo.url;
this.logo.bgColor = logoInfo.backgroundColor || 'transparent';
this.logo.url = info.contact && info.contact.url || null;
}
2016-08-28 21:46:10 +03:00
ngOnInit() {
this.preinit();
}
}