Skip to content

Commit

Permalink
Closes #322: Feature request: Clickable logo that points to specific url
Browse files Browse the repository at this point in the history
  • Loading branch information
khorolets authored and RomanHotsiy committed Aug 17, 2017
1 parent 6b61d3a commit cb3d318
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/components/ApiLogo/api-logo.html
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<img *ngIf="logo.imgUrl" [attr.src]="logo.imgUrl" [ngStyle]="{'background-color': logo.bgColor}">
<a *ngIf="logo.url" href="{{logo.url}}">
<img *ngIf="logo.imgUrl" [attr.src]="logo.imgUrl" [ngStyle]="{'background-color': logo.bgColor}">
</a>
<img *ngIf="logo.imgUrl && !logo.url" [attr.src]="logo.imgUrl" [ngStyle]="{'background-color': logo.bgColor}">
3 changes: 3 additions & 0 deletions lib/components/ApiLogo/api-logo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export class ApiLogo extends BaseComponent implements OnInit {

init() {
let logoInfo = this.componentSchema.info['x-logo'];
if ('url' in this.componentSchema.info['contact']) {
this.logo.url = this.componentSchema.info['contact']['url'];
}
if (!logoInfo) return;
this.logo.imgUrl = logoInfo.url;
this.logo.bgColor = logoInfo.backgroundColor || 'transparent';
Expand Down

0 comments on commit cb3d318

Please sign in to comment.