Skip to content

Commit a387ad2

Browse files
committed
fix(alert) write access permission
1 parent 403517e commit a387ad2

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.github/workflows/commitlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
- submitted
1515

1616
permissions:
17-
pull-requests: read
17+
pull-requests: write
1818

1919
# Separate jobs can run concurrently
2020
jobs:

elements/pf-alert/pf-alert.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ export class PfAlert extends LitElement {
5353
| 'neutral'
5454
| 'info'
5555
| 'success'
56-
| 'danger'
57-
| 'cogear' = 'neutral';
56+
| 'danger' = 'neutral';
5857

5958
@property({ reflect: true }) variant?: 'alternate' | 'inline';
6059

@@ -63,15 +62,18 @@ export class PfAlert extends LitElement {
6362
#slots = new SlotController(this, 'header', null, 'actions');
6463

6564
get #icon() {
66-
const state = this.status.toLowerCase() as this['status'];
67-
switch (state) {
65+
const internalStatus = this.closest('.demo-with-arrows') &&
66+
this.status === 'neutral' && this.classList.contains('cogear-demo')
67+
? 'cogear'
68+
: this.status;
69+
switch (internalStatus) {
6870
// @ts-expect-error: support for deprecated props
6971
case 'note': return ICONS.get('info');
7072
// @ts-expect-error: support for deprecated props
7173
case 'default': return ICONS.get('neutral');
7274
// @ts-expect-error: support for deprecated props
7375
case 'error': return ICONS.get('danger');
74-
default: return ICONS.get(state);
76+
default: return ICONS.get(internalStatus);
7577
}
7678
}
7779

@@ -108,10 +110,13 @@ export class PfAlert extends LitElement {
108110
const hasBody =
109111
_isServer || this.#slots.hasSlotted(SlotController.default as unknown as string);
110112
const { variant = 'inline' } = this;
111-
const state = this.#aliasState(this.status);
113+
// const state = this.#aliasState(this.status);
112114
const inDemo = this.closest('.demo-with-arrows') !== null;
113115
const hasDescription = this.querySelector('p') !== null;
114116
const showArrow = inDemo;
117+
const internalStatus = (this.closest('.demo-with-arrows') && this.classList.contains('cogear-demo'))
118+
? 'cogear'
119+
: this.status;
115120
const arrowDirection = hasDescription ? 'angle-down' : 'angle-right';
116121
const footer = html`<footer class="${classMap({ hasActions })}"
117122
<!-- Provide actions that the user can take for the alert -->
@@ -124,8 +129,8 @@ export class PfAlert extends LitElement {
124129
${classMap({
125130
hasBody,
126131
light: true,
127-
[this.status as string]: true,
128-
[variant]: !!variant,
132+
[internalStatus]: true,
133+
[variant ?? 'inline']: !!variant,
129134
})}
130135
role="alert"
131136
aria-hidden="false"

0 commit comments

Comments
 (0)