Skip to content

Commit 3f23e1d

Browse files
committed
fix(alert): fix pf alert new -no --verfy
1 parent 2f096c6 commit 3f23e1d

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
<pf-button>Add </pf-button>
2-
<pf-button></pf-button>
1+
<pf-button>Add alert</pf-button>
2+
<pf-button>Remove all alerts</pf-button>
33

44
<script type="module">
55
import '@patternfly/elements/pf-alert/pf-alert.js';
66
import '@patternfly/elements/pf-button/pf-button.js';
7-
</script>
7+
</script>
8+
9+
10+
11+
12+

elements/pf-alert/demo/inline-alert-variants.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<h3 slot="title">Custom inline alert title</h3>
44
</pf-alert>
55

6-
<pf-alert variant="info">
6+
<pf-alert variant="info" onClose>
77
<h3 slot="title">Info inline alert title</h3>
88
</pf-alert>
99

1010
<pf-alert variant="success">
1111
<h3 slot="title">Success inline alert title</h3>
1212
</pf-alert>
1313

14-
<pf-alert variant="warning">
14+
<pf-alert variant="warning" >
1515
<h3 slot="title">Warning inline alert title</h3>
1616
</pf-alert>
1717

elements/pf-alert/demo/static-live-region-alerts.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ <h3 slot="title">Customized live region</h3>
2222

2323
<script type="module">
2424
import '@patternfly/elements/pf-alert/pf-alert.js';
25-
import '@patternfly/elements/pf-icon/pf-icon.js';
26-
2725
</script>
2826
<style>
2927
.alerts-page pf-alert::part(container) {

elements/pf-alert/pf-alert.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { property } from 'lit/decorators/property.js';
44
import { classMap } from 'lit/directives/class-map.js';
55
import { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';
66
import '@patternfly/elements/pf-icon/pf-icon.js';
7+
import '@patternfly/elements/pf-button/pf-button.js';
78
import styles from './pf-alert.css';
89

910

@@ -22,8 +23,16 @@ export class PfAlert extends LitElement {
2223

2324
@property() icon?: string;
2425

26+
@property({ reflect: true, type: Boolean }) onClose = false;
27+
28+
2529
#slots = new SlotController(this, null, 'icon', 'actionClose', 'title');
2630

31+
#onCloseClick() {
32+
if (this.isConnected) {
33+
this.remove();
34+
}
35+
}
2736

2837
override render(): TemplateResult<1> {
2938
const { variant } = this;
@@ -53,6 +62,14 @@ export class PfAlert extends LitElement {
5362
<slot></slot>
5463
</div>
5564
65+
<pf-button id="close-button"
66+
plain
67+
icon="close"
68+
icon-set="patternfly"
69+
?hidden="${!this.onClose}"
70+
@click="${this.#onCloseClick}">
71+
</pf-button>
72+
5673
</div>
5774
`;
5875
}

0 commit comments

Comments
 (0)