Skip to content
Open
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div
class="text-center text-truncate si-h5 banner"
class="text-center text-truncate si-body banner"
role="alert"
aria-atomic="true"
aria-live="assertive"
>
{{ message() | translate }}
{{ message() | translate }} <ng-content select="a" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of this, we just want to allow any content inside based on my understanding, so:

Suggested change
{{ message() | translate }} <ng-content select="a" />
<ng-content>{{ message() | translate }}</ng-content>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

.banner {
padding-block: variables.$si-system-banner-padding-y;
padding-inline: map.get(variables.$spacers, 5);
padding-inline: map.get(variables.$spacers, 4);

::ng-deep a {
color: inherit;
text-decoration: underline;
}
}

&.banner-info {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
* Copyright (c) Siemens 2016 - 2026
* SPDX-License-Identifier: MIT
*/
import { inputBinding, signal, WritableSignal } from '@angular/core';
import { Component, inputBinding, signal, WritableSignal } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ExtendedStatusType } from '@siemens/element-ng/common';

import { SiSystemBannerComponent } from './system-banner.component';

@Component({
imports: [SiSystemBannerComponent],
template: `
<si-system-banner message="Update available">
<a href="https://element.siemens.io/">Learn more</a>
<span>Unsupported content</span>
</si-system-banner>
`
})
class TestHostComponent {}

describe('SiSystemBannerComponent', () => {
let fixture: ComponentFixture<SiSystemBannerComponent>;
let element: HTMLElement;
Expand All @@ -34,6 +45,17 @@ describe('SiSystemBannerComponent', () => {
expect(element).toHaveTextContent('Test');
});

it('should display projected content as part of the message', async () => {
const hostFixture = TestBed.createComponent(TestHostComponent);
await hostFixture.whenStable();

const alert = hostFixture.nativeElement.querySelector('[role="alert"]');

expect(alert).toHaveTextContent('Update available Learn more');
expect(alert).not.toHaveTextContent('Unsupported content');
expect(alert.querySelector('a')).toHaveAttribute('href', 'https://element.siemens.io/');
});

it('should have default banner type', () => {
expect(status()).toBe('info');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $btn-width-normal: 80px;
$si-application-header-height: calc(1.5rem + (2 * map.get(spacers.$spacers, 5) + 1px));
$si-titlebar-padding-y: map.get(spacers.$spacers, 3);
$si-titlebar-height: calc(1.5rem + 2 * $si-titlebar-padding-y);
$si-system-banner-padding-y: map.get(spacers.$spacers, 1);
$si-system-banner-padding-y: map.get(spacers.$spacers, 2);
$si-system-banner-height: calc(1rem + 2 * $si-system-banner-padding-y);

// allows adding a custom titlebar on top
Expand Down
3 changes: 3 additions & 0 deletions src/app/examples/si-system-banner/si-system-banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
<si-system-banner message="This is a caution" status="caution" />
<si-system-banner message="This is an error" status="danger" />
<si-system-banner message="This is a critical error" status="critical" />
<si-system-banner message="Update available" status="info">
<a class="banner-link" href="https://element.siemens.io/">Learn more</a>
</si-system-banner>
</div>
Loading