Skip to content

Commit

Permalink
fix: 修复 toast 消失未移除 dom 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy committed Jan 12, 2024
1 parent 2117e5c commit fd1e05e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/quarkd/src/toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class QuarkToast extends QuarkElement {
if (!el.classList.contains("quark-toast-leave")) return;
if (el && el.parentNode && !this.show) {
try {
// document.body.removeChild(this);
document.body.removeChild(this);
} catch (error) {
// todo something
}
Expand Down Expand Up @@ -146,8 +146,8 @@ class QuarkToast extends QuarkElement {
<div
class={`quark-toast quark-toast--${this.loadingIconDirection}`}
ref={this.toastRef}
style={{ minHeight: `var(--toast-height, 120px)` }}
>
{this.type !== "text" && this.renderIcon()}
<quark-loading
ref={this.loadingtRef}
size={this.iconSize}
Expand Down Expand Up @@ -179,6 +179,10 @@ class QuarkToast extends QuarkElement {
maxWidth: `var(--toast-max-width, 240px)`,
padding: `var(--toast-text-padding, 16px 20px)`,
fontSize: `var(--toast-font-size, 14px)`,
minHeight:
this.type !== "text" && this.loadingIconDirection !== "horizontal"
? `var(--toast-height, 120px)`
: "auto",
}}
>
{this.type !== "text" && this.renderIcon()}
Expand Down
4 changes: 2 additions & 2 deletions packages/quarkd/src/toast/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
pointer-events: all;
width: var(--toast-width, 120px);
min-height: var(--toast-height, 120px);
text-align: center;
transition: opacity var(--toast-transition-fade-in, 0.3s) ease-in;
position: fixed;
Expand All @@ -43,6 +42,7 @@
height: auto;
min-width: var(--toast-min-width, 120px);
max-width: var(--toast-max-width, 240px);
min-height: auto !important;
}

:host([show]) .quark-toast {
Expand All @@ -51,7 +51,7 @@

:host([type="text"]) .quark-toast {
padding: var(--toast-text-padding, 16px 20px);
width: auto;
width: max-content;
height: auto;
min-width: var(--toast-min-width, 120px);
max-width: var(--toast-max-width, 240px);
Expand Down

0 comments on commit fd1e05e

Please sign in to comment.