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

IgxBannerComponent - Support collapsed input #14890

Closed
mrentmeister-tt opened this issue Oct 7, 2024 · 0 comments · Fixed by #14935
Closed

IgxBannerComponent - Support collapsed input #14890

mrentmeister-tt opened this issue Oct 7, 2024 · 0 comments · Fixed by #14935
Assignees
Labels
banner Banner component 🧰 feature-request ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@mrentmeister-tt
Copy link

Is your feature request related to a problem? Please describe.

I have a global notification banner list component. Whenever banners need to be shown, a service manages a list of banner components to put on the page. I loop through this list in the html, and render an igx-banner component for each message that needs to be shown. Looking through the source code, I don't see any way to set the initial state of the banner component to be expanded when rendered, so that I don't have to call open() on each individual banner after it's added to the DOM.

Describe the solution you'd like

Support an input property collapsed getter/setter, or some other property name.

Describe alternatives you've considered

Currently right now I have an effect that opens the banner whenever the viewChildren signal changes. It would be nice to not have to do this though:

@for (banner of banners(); track banner.id) {
  <igx-banner
    #igxBanner
    class="tt-banner tt-banner--{{ banner.type }}"
    (closed)="bannerStore.remove(banner.id)"
  >
    @if (banner.icon) {
      <igx-icon>{{ banner.icon }}</igx-icon>
    }
    {{ banner.message }}
  </igx-banner>
}
import { explicitEffect } from 'ngxtension/explicit-effect';

export class BannerListComponent {
  protected readonly bannerStore = inject(BannerStore);
  readonly banners = this.bannerStore.prioritized;
  protected readonly bannerComponents = viewChildren(IgxBannerComponent);

  constructor() {
    explicitEffect([this.bannerComponents], ([bannerComponents]) => {
      bannerComponents.forEach(bannerComponent => {
        bannerComponent.open();
      });
    });
  }
}
@georgianastasov georgianastasov added 🛠️ status: in-development Issues and PRs with active development on them banner Banner component and removed 🆕 status: new labels Oct 22, 2024
@georgianastasov georgianastasov added ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed 🛠️ status: in-development Issues and PRs with active development on them labels Oct 22, 2024
@georgianastasov georgianastasov added 🛠️ status: in-development Issues and PRs with active development on them ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. 🛠️ status: in-development Issues and PRs with active development on them labels Nov 20, 2024
@georgianastasov georgianastasov added 🛠️ status: in-development Issues and PRs with active development on them ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. 🛠️ status: in-development Issues and PRs with active development on them labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
banner Banner component 🧰 feature-request ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants