Skip to content

Commit 8e6583a

Browse files
committed
feat(alerts): remove hello-goodbye
Consumers can use auto-animate instead
1 parent bb9b0ce commit 8e6583a

File tree

2 files changed

+3
-38
lines changed

2 files changed

+3
-38
lines changed

src/alerts/README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ type AlertOptions = {
6262
// If -1, the alert will not automatically disappear.
6363
// If undefined, the default value will be used.
6464
duration?: number;
65-
66-
// Whether or not to animate the alert in, using a hello-goodbye transition.
67-
// Defaults to true.
68-
animate?: boolean;
6965
};
7066

7167
// The `key` and `duration` options can also be specified as [data-*] attributes
@@ -90,23 +86,6 @@ ui-alerts {
9086
flex-direction: column-reverse;
9187
align-items: flex-end;
9288
}
93-
94-
/* Transitions can be applied to alerts using hello-goodbye */
95-
@media (prefers-reduced-motion: no-preference) {
96-
ui-alerts > .enter-active,
97-
ui-alerts > .leave-active,
98-
ui-alerts > .move {
99-
transition: all 0.5s;
100-
}
101-
102-
ui-alerts > .enter-from {
103-
transform: translateY(-100%);
104-
}
105-
106-
ui-alerts > .leave-to {
107-
opacity: 0;
108-
}
109-
}
11089
```
11190

11291
## Further Reading

src/alerts/alerts.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { hello, goodbye, move } from 'hello-goodbye';
2-
31
export type AlertOptions = {
42
key?: string;
53
duration?: number;
6-
animate?: boolean;
74
};
85

96
export default class AlertsElement extends HTMLElement {
@@ -42,7 +39,7 @@ export default class AlertsElement extends HTMLElement {
4239
}
4340

4441
for (const child of this.children) {
45-
this.show(child as HTMLElement, { animate: false });
42+
this.show(child as HTMLElement);
4643
}
4744
}
4845

@@ -54,16 +51,7 @@ export default class AlertsElement extends HTMLElement {
5451
el.dataset.key = key;
5552

5653
if (!this.contains(el)) {
57-
if (options.animate === false) {
58-
this.append(el);
59-
} else {
60-
move(this.children, () => {
61-
this.append(el);
62-
hello(el);
63-
});
64-
}
65-
} else {
66-
hello(el);
54+
this.append(el);
6755
}
6856

6957
this.added.add(el);
@@ -105,9 +93,7 @@ export default class AlertsElement extends HTMLElement {
10593

10694
this.added.delete(elOrKey);
10795

108-
move(this.children, () =>
109-
goodbye(elOrKey).then(() => elOrKey.remove())
110-
);
96+
elOrKey.remove();
11197

11298
this.clearTimeout(elOrKey);
11399
}

0 commit comments

Comments
 (0)