-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1044 from puzzle/feature/987-display-filter
Feature/987 display filter
- Loading branch information
Showing
5 changed files
with
16 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
25 changes: 7 additions & 18 deletions
25
frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,20 @@ | ||
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 DEFAULT_TRIANGLE_SRC = '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.DEFAULT_TRIANGLE_SRC), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters