Skip to content

Commit 2f74586

Browse files
author
m2rt
committed
feat(toast): changes/improvements from design review #270
1 parent 8c25a1e commit 2f74586

2 files changed

Lines changed: 27 additions & 23 deletions

File tree

tedi/components/notifications/toast/toast.component.scss

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,23 @@ tedi-toast {
88

99
.tedi-toast__wrapper {
1010
position: relative;
11-
box-shadow: 0px 1px 5px 0px var(--tedi-alpha-20, rgba(0, 0, 0, 0.2));
11+
padding: var(--toast-outer-spacing, 4px);
12+
13+
tedi-alert {
14+
box-shadow: 0 4px 10px 0 var(--tedi-alpha-14, rgba(0, 0, 0, 0.14));
15+
}
1216
}
1317

1418
.tedi-toast__progress {
1519
position: absolute;
16-
bottom: 0;
17-
left: 0;
18-
width: 100%;
20+
bottom: var(--toast-outer-spacing);
21+
left: var(--toast-outer-spacing);
22+
width: calc(100% - var(--toast-outer-spacing) * 2);
1923
height: 4px;
2024
background: var(--toast-progress-color);
2125
transform-origin: left;
2226
animation: toast-progress linear forwards;
27+
border-radius: 0 var(--alert-radius) 0 var(--alert-radius);
2328

2429
&--success {
2530
--toast-progress-color: var(--alert-default-border-success);
@@ -54,15 +59,15 @@ tedi-toast {
5459
flex-direction: column;
5560
gap: var(--dimensions-05);
5661
max-height: calc(100vh - calc(var(--toast-margin-bottom) * 2));
57-
overflow: hidden;
62+
overflow: visible;
5863

5964
>* {
6065
pointer-events: auto;
6166
}
6267

6368
&--top-left {
6469
top: var(--toast-margin-bottom);
65-
left: var(--toast-margin-left);
70+
left: var(--toast-margin-right);
6671
align-items: flex-start;
6772

6873
tedi-toast {
@@ -90,7 +95,7 @@ tedi-toast {
9095

9196
&--bottom-left {
9297
bottom: var(--toast-margin-bottom);
93-
left: var(--toast-margin-left);
98+
left: var(--toast-margin-right);
9499
align-items: flex-start;
95100
flex-direction: column-reverse;
96101

tedi/components/notifications/toast/toast.stories.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ type Story = StoryObj<ToastComponent>;
119119
standalone: true,
120120
imports: [ButtonComponent, RowComponent, ColComponent, VerticalSpacingDirective],
121121
template: `
122-
<div [tediVerticalSpacing]="1">
122+
<div [tediVerticalSpacing]="0.5">
123123
<tedi-row>
124124
<tedi-col [lg]="12">
125125
<button tedi-button (click)="showSuccess()">Show success toast</button>
@@ -235,16 +235,14 @@ export const WithIcon: Story = {
235235
standalone: true,
236236
imports: [ButtonComponent, RowComponent, ColComponent, VerticalSpacingDirective],
237237
template: `
238-
<div [tediVerticalSpacing]="1">
239-
<tedi-row>
240-
<tedi-col>
241-
<button tedi-button (click)="show(2)">Auto close in 2s</button>
242-
</tedi-col>
243-
<tedi-col>
244-
<button tedi-button (click)="show(10)">Auto close in 10s</button>
245-
</tedi-col>
246-
</tedi-row>
247-
</div>
238+
<tedi-row gap="2">
239+
<tedi-col>
240+
<button tedi-button (click)="show(2)">Auto close in 2s</button>
241+
</tedi-col>
242+
<tedi-col>
243+
<button tedi-button (click)="show(10)">Auto close in 10s</button>
244+
</tedi-col>
245+
</tedi-row>
248246
`,
249247
})
250248
class ToastTimerDemoComponent {
@@ -337,8 +335,8 @@ export const PersistentToast: Story = {
337335
standalone: true,
338336
imports: [ButtonComponent, RowComponent, ColComponent, VerticalSpacingDirective],
339337
template: `
340-
<div [tediVerticalSpacing]="1">
341-
<tedi-row>
338+
<div [tediVerticalSpacing]="0.5">
339+
<tedi-row gap="2">
342340
<tedi-col>
343341
<button tedi-button variant="secondary" (click)="showTopLeft()">
344342
Top Left
@@ -350,7 +348,7 @@ export const PersistentToast: Story = {
350348
</button>
351349
</tedi-col>
352350
</tedi-row>
353-
<tedi-row>
351+
<tedi-row gap="2">
354352
<tedi-col>
355353
<button tedi-button variant="secondary" (click)="showBottomLeft()">
356354
Bottom Left
@@ -395,6 +393,7 @@ class ToastPositionDemoComponent {
395393

396394
/**
397395
* Toast notifications at different screen positions.
396+
* Default and also recommended value is "bottom-right"
398397
*/
399398
export const Positions: Story = {
400399
decorators: [
@@ -426,7 +425,7 @@ this.toastService.info("Bottom Right", "Message", { position: "bottom-right" });
426425
standalone: true,
427426
imports: [ButtonComponent, RowComponent, ColComponent],
428427
template: `
429-
<tedi-row>
428+
<tedi-row gap="2">
430429
<tedi-col>
431430
<button tedi-button (click)="showPauseOnHover()">
432431
Pause on hover
@@ -494,7 +493,7 @@ this.toastService.danger("No Pause", "Closes even if hovered", {
494493
standalone: true,
495494
imports: [ButtonComponent, RowComponent, ColComponent],
496495
template: `
497-
<tedi-row>
496+
<tedi-row gap="2">
498497
<tedi-col>
499498
<button tedi-button (click)="showStatus()">
500499
Success (role=status)

0 commit comments

Comments
 (0)