Fix my-feed popover title state

This commit is contained in:
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
*ngIf="syndicationItems && syndicationItems.length !== 0"
#popover="ngbPopover"
[ngbPopover]="feedsList" [autoClose]="true" placement="bottom left auto"
class="feed border-0 p-0"
title="Open syndication dropdown" i18n-title
class="feed border-0 p-0" [title]="getTitle()"
>
<my-global-icon iconName="syndication"></my-global-icon>

View File

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