Fix my-feed popover title state

pull/6449/head
Chocobozzz 2024-06-10 11:32:39 +02:00
parent b455a59bfd
commit f027bdb4b0
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 16 additions and 6 deletions

View File

@ -1,8 +1,8 @@
<button <button
*ngIf="syndicationItems && syndicationItems.length !== 0" *ngIf="syndicationItems && syndicationItems.length !== 0"
#popover="ngbPopover"
[ngbPopover]="feedsList" [autoClose]="true" placement="bottom left auto" [ngbPopover]="feedsList" [autoClose]="true" placement="bottom left auto"
class="feed border-0 p-0" class="feed border-0 p-0" [title]="getTitle()"
title="Open syndication dropdown" i18n-title
> >
<my-global-icon iconName="syndication"></my-global-icon> <my-global-icon iconName="syndication"></my-global-icon>

View File

@ -1,8 +1,8 @@
import { Component, Input } from '@angular/core' import { NgFor, NgIf } from '@angular/common'
import { Syndication } from './syndication.model' import { Component, Input, ViewChild } from '@angular/core'
import { GlobalIconComponent } from '../../shared-icons/global-icon.component'
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
import { NgIf, NgFor } from '@angular/common' import { GlobalIconComponent } from '../../shared-icons/global-icon.component'
import { Syndication } from './syndication.model'
@Component({ @Component({
selector: 'my-feed', selector: 'my-feed',
@ -12,5 +12,15 @@ import { NgIf, NgFor } from '@angular/common'
imports: [ NgIf, NgbPopover, GlobalIconComponent, NgFor ] imports: [ NgIf, NgbPopover, GlobalIconComponent, NgFor ]
}) })
export class FeedComponent { export class FeedComponent {
@ViewChild('popover') popover: NgbPopover
@Input() syndicationItems: Syndication[] @Input() syndicationItems: Syndication[]
getTitle () {
if (this.popover?.isOpen()) {
return $localize`Close syndication dropdown`
}
return $localize`Open syndication dropdown`
}
} }