Skip to content

Commit

Permalink
fix display of tangram
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Oct 18, 2024
1 parent 31a37ce commit b32221e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="okrBanner" #okrBanner>
<div class="d-flex flex-row">
<div [ngClass]="isMobileDevice() ? 'filters' : 'none'" class="w-100 h-100 m-0 d-flex filters" slot="content">
<div class="w-100 h-100 m-0 d-flex" slot="content">
<section class="d-none d-md-flex">
<div class="header-content h-100 m-0 pt-3 pb-3 d-flex gap-2 flex-column container-fluid">
<div class="d-flex align-items-end gap-2">
Expand Down Expand Up @@ -35,7 +35,7 @@
</mat-accordion>
</section>
</div>
<div *ngIf="!isMobileDevice()" class="d-flex justify-content-end">
<div class="d-flex justify-content-end d-none d-md-flex">
<app-okr-tangram [attr.data-testId]="'okr-logo'"></app-okr-tangram>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<div [style.width]="getWidth()">
<img alt="okr-logo" src="{{ this.trianglesSrc$ | async }}" />
</div>
<img alt="okr-logo" ngSrc="{{ this.trianglesSrc$ | async }}" width="274" height="140" />
Original file line number Diff line number Diff line change
@@ -1,11 +0,0 @@
div {
display: block;
width: 100px;

@media (min-width: 576px) {
width: 180px;
}
@media (min-width: 992px) {
width: 274px;
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
import { Component } from '@angular/core';
import { isMobileDevice } from '../../common';
import { ConfigService } from '../../../services/config.service';
import { BehaviorSubject, Subscription } from 'rxjs';
import { BehaviorSubject, map, Observable, Subject, Subscription } from 'rxjs';

@Component({
selector: 'app-okr-tangram',
templateUrl: 'okr-tangram.component.html',
styleUrl: 'okr-tangram.component.scss',
})
export class OkrTangramComponent {
private readonly MOBILE_WIDTH = 100;
private readonly DESKTOP_WIDTH = 274;
private readonly defaultTrianglesSrc = 'assets/images/empty.svg';
trianglesSrc$ = new Observable<string>();

getWidth() {
return isMobileDevice() ? this.MOBILE_WIDTH : this.DESKTOP_WIDTH;
}

private subscription?: Subscription;
trianglesSrc$ = new BehaviorSubject<String>('assets/images/empty.svg');

constructor(private configService: ConfigService) {}

ngOnInit(): void {
this.subscription = this.configService.config$.subscribe((config) => {
if (config.triangles) {
this.trianglesSrc$.next(config.triangles);
}
});
constructor(private readonly configService: ConfigService) {
this.trianglesSrc$ = this.configService.config$.pipe(map((config) => config.triangles || this.defaultTrianglesSrc));
}
}

0 comments on commit b32221e

Please sign in to comment.