mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 21:30:04 +08:00
552cf56afe
- more subtle animation when showing a toast - resumes auto close when removing the mouse from the toast - correctly follows reduced motion - uses output with role status as element: https://web.dev/articles/building/a-toast-component - shows toasts inside a section element - prevents toast to all have the same width - fixes a bug on mobile where we would limit the width and the close button wouldn't show correctly aligned I would prefer to have tests for this, but the conjunction of css/animations and our helper changing `discourseLater` to 0 in tests is making it quite challenging for a rather low value. We have system specs using toasts ensuring they show when they should.
101 lines
1.6 KiB
SCSS
101 lines
1.6 KiB
SCSS
.fk-d-default-toast {
|
|
display: flex;
|
|
flex: 1 1 auto;
|
|
padding: 0.5rem;
|
|
|
|
&__close-container {
|
|
width: calc(40px - 0.5rem);
|
|
height: 30px;
|
|
}
|
|
|
|
&__icon-container {
|
|
flex: 1 0 auto;
|
|
display: flex;
|
|
width: calc(40px - 0.5rem);
|
|
height: 30px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
&.alert-success {
|
|
background-color: var(--success-low);
|
|
color: var(--primary);
|
|
}
|
|
&.alert-error {
|
|
background-color: var(--danger-low);
|
|
color: var(--primary);
|
|
}
|
|
&.alert-warning {
|
|
background-color: var(--highlight-bg);
|
|
color: var(--primary);
|
|
}
|
|
&.alert-info {
|
|
background-color: var(--tertiary-low);
|
|
color: var(--primary);
|
|
&.clickable {
|
|
color: var(--tertiary);
|
|
z-index: z("base");
|
|
}
|
|
}
|
|
|
|
.-success & {
|
|
.d-icon {
|
|
color: var(--success);
|
|
}
|
|
}
|
|
|
|
.-error & {
|
|
.d-icon {
|
|
color: var(--danger);
|
|
}
|
|
}
|
|
|
|
.-warning & {
|
|
.d-icon {
|
|
color: var(--highlight);
|
|
}
|
|
}
|
|
|
|
.-info & {
|
|
.d-icon {
|
|
color: var(--tertiary);
|
|
}
|
|
}
|
|
}
|
|
|
|
&__main-container {
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
min-height: 30px;
|
|
}
|
|
|
|
&__texts {
|
|
min-height: 30px;
|
|
display: flex;
|
|
justify-content: center;
|
|
flex-direction: column;
|
|
}
|
|
|
|
&__actions {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
padding-top: 1rem;
|
|
margin-bottom: -0.5rem;
|
|
|
|
.btn {
|
|
margin-right: 0.5rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
}
|
|
|
|
&__title {
|
|
display: flex;
|
|
font-weight: 700;
|
|
}
|
|
|
|
&__message {
|
|
display: flex;
|
|
}
|
|
}
|