Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add width limitation to only mobile version and remove margin fr… #2026

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@
>
<div class="vl"></div>
</ng-container>
<h4 class="orc-font-body">
<h4
class="orc-font-body"
[ngClass]="{
mobile: isMobile
}"
>
{{ affiliation.affiliationName.value }}:

<ng-container *ngIf="affiliation.city.value">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@
.affiliation-title {
display: flex;
align-items: center;
margin: 0;

h4 {
margin: 0;
}

h4.mobile {
max-width: calc(100% - 50px);
}

mat-icon {
margin-inline-end: 4px;
}

.vl {
height: 28px;
margin-inline-start: 8px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, HostBinding, Input, OnInit } from '@angular/core'
import { combineLatest, Observable, of } from 'rxjs'
import { first } from 'rxjs/operators'
import { Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core'
import { combineLatest, Observable, of, Subject } from 'rxjs'
import { first, takeUntil } from 'rxjs/operators'
import { OrganizationsService } from 'src/app/core'
import { RecordAffiliationService } from 'src/app/core/record-affiliations/record-affiliations.service'
import { OrgDisambiguated, UserInfo } from 'src/app/types'
Expand All @@ -13,6 +13,7 @@ import {
import { UserRecord } from 'src/app/types/record.local'
import { ModalAffiliationsComponent } from '../affiliation-stacks-groups/modals/modal-affiliations/modal-affiliations.component'
import { TogglzService } from '../../../core/togglz/togglz.service'
import { PlatformInfoService } from '../../../cdk/platform-info'

@Component({
selector: 'app-affiliation-stack',
Expand All @@ -22,7 +23,9 @@ import { TogglzService } from '../../../core/togglz/togglz.service'
'./affiliation-stack.component.scss-theme.scss',
],
})
export class AffiliationStackComponent implements OnInit {
export class AffiliationStackComponent implements OnInit, OnDestroy {
$destroy: Subject<boolean> = new Subject<boolean>()

@HostBinding('class.display-the-stack') displayTheStackClass = false
_affiliationStack: AffiliationGroup
@Input() userRecord: UserRecord
Expand Down Expand Up @@ -83,11 +86,13 @@ export class AffiliationStackComponent implements OnInit {
}
} = {}
modalAffiliationsComponent = ModalAffiliationsComponent
isMobile: boolean

constructor(
private _affiliationService: RecordAffiliationService,
private _organizationsService: OrganizationsService,
private _togglz: TogglzService
private _togglz: TogglzService,
private _platform: PlatformInfoService,
) {}

/**
Expand Down Expand Up @@ -216,5 +221,17 @@ export class AffiliationStackComponent implements OnInit {
return false
}

ngOnInit(): void {}
ngOnInit(): void {
this._platform
.get()
.pipe(takeUntil(this.$destroy))
.subscribe(
(platform) => (this.isMobile = platform.columns4 || platform.columns8)
)
}

ngOnDestroy() {
this.$destroy.next(true)
this.$destroy.unsubscribe()
}
}