|
32 | 32 | export let actionText: string = ""; |
33 | 33 | export let visible: boolean = true; |
34 | 34 | export let animationDirection: TemporaryNotificationAnimationDirection = "down"; |
| 35 | +
|
| 36 | + // Icon size for success/failure icons |
| 37 | + const iconSize = "large"; |
35 | 38 | </script> |
36 | 39 |
|
37 | 40 | <div |
|
47 | 50 | class:animate-down={animationDirection === "down"} |
48 | 51 | data-testid={testid} |
49 | 52 | > |
50 | | - {#if type === "success"} |
51 | | - <goa-icon type="checkmark-circle" /> |
52 | | - {/if} |
| 53 | + <div class="content"> |
| 54 | + {#if type === "success"} |
| 55 | + <goa-icon type="checkmark-circle" size={iconSize} /> |
| 56 | + {/if} |
53 | 57 |
|
54 | | - {#if type === "failure"} |
55 | | - <goa-icon type="close-circle" /> |
56 | | - {/if} |
| 58 | + {#if type === "failure"} |
| 59 | + <goa-icon type="close-circle" size={iconSize} /> |
| 60 | + {/if} |
57 | 61 |
|
58 | | - <span class="message"> |
59 | | - {message} |
60 | | - </span> |
| 62 | + <span class="message"> |
| 63 | + {message} |
| 64 | + </span> |
| 65 | + </div> |
61 | 66 |
|
62 | 67 | {#if actionText} |
63 | 68 | <div class="action"> |
|
82 | 87 | flex-direction: row; |
83 | 88 | flex-wrap: wrap; |
84 | 89 | align-items: center; |
85 | | - border-radius: var(--goa-border-radius-m); |
86 | | - gap: var(--goa-space-m); |
87 | | - padding: var(--goa-space-m) var(--goa-space-l); |
88 | | - max-width: 640px; |
89 | | - color: var(--goa-color-text-light); |
90 | | - transition: transform 0.3s ease, opacity 0.3s ease; |
| 90 | + border-radius: var(--goa-temporary-notification-borderRadius, var(--goa-border-radius-m)); |
| 91 | + gap: var(--goa-temporary-notification-row-gap, var(--goa-space-m)); /* 16px between content and action */ |
| 92 | + padding: var(--goa-temporary-notification-padding, var(--goa-space-m) var(--goa-space-l)); |
| 93 | + max-width: var(--goa-temporary-notification-max-width, 640px); |
| 94 | + color: var(--goa-temporary-notification-color-text, var(--goa-color-text-light)); |
| 95 | + transition: |
| 96 | + transform var(--goa-temporary-notification-transition-duration, 0.3s) ease, |
| 97 | + opacity var(--goa-temporary-notification-transition-duration, 0.3s) ease; |
91 | 98 | overflow: hidden; |
92 | 99 | } |
93 | 100 |
|
| 101 | + /* Add extra bottom padding when progress bar is present */ |
| 102 | + .snackbar.progress, |
| 103 | + .snackbar.indeterminate { |
| 104 | + padding: var(--goa-temporary-notification-padding-with-progress, var(--goa-space-m) var(--goa-space-l) 22px var(--goa-space-l)); |
| 105 | + } |
| 106 | +
|
| 107 | + /* Content wrapper keeps icon and message together as a single flex item */ |
| 108 | + .content { |
| 109 | + display: flex; |
| 110 | + align-items: flex-start; /* Icon aligns with first line of text */ |
| 111 | + gap: var(--goa-temporary-notification-column-gap, var(--goa-space-s)); |
| 112 | + flex: 1 1 auto; |
| 113 | + min-width: 0; /* Allow content to shrink */ |
| 114 | + } |
| 115 | +
|
94 | 116 | @media (--not-mobile) { |
95 | 117 | .snackbar { |
96 | | - min-width: 360px; |
| 118 | + min-width: var(--goa-temporary-notification-min-width-desktop, 360px); |
97 | 119 | } |
98 | 120 | } |
99 | 121 |
|
|
107 | 129 | .snackbar.basic, |
108 | 130 | .snackbar.indeterminate, |
109 | 131 | .snackbar.progress { |
110 | | - border: 1px solid var(--goa-color-greyscale-700); |
111 | | - background: var(--goa-color-greyscale-black); |
| 132 | + border: var(--goa-temporary-notification-borderWidth, var(--goa-border-width-s)) solid var(--goa-temporary-notification-color-border, var(--goa-color-greyscale-700)); |
| 133 | + background: var(--goa-temporary-notification-color-bg-basic, var(--goa-color-greyscale-black)); |
112 | 134 | } |
113 | 135 |
|
114 | 136 | .action { |
|
123 | 145 | bottom: 0; |
124 | 146 | left: 0; |
125 | 147 | width: 100%; |
126 | | - height: 6px; |
| 148 | + height: var(--goa-temporary-notification-progress-bar-height, 6px); |
| 149 | + border-radius: 0 0 var(--goa-temporary-notification-progress-bar-borderRadius, 0) var(--goa-temporary-notification-progress-bar-borderRadius, 0); |
| 150 | + } |
| 151 | +
|
| 152 | + /* Progress bar browser-specific styling */ |
| 153 | + progress::-webkit-progress-bar { |
| 154 | + background-color: var(--goa-temporary-notification-progress-bar-color-bg, #adadad); |
| 155 | + border-radius: 0 0 var(--goa-temporary-notification-progress-bar-borderRadius, 0) var(--goa-temporary-notification-progress-bar-borderRadius, 0); |
| 156 | + } |
| 157 | +
|
| 158 | + progress::-webkit-progress-value { |
| 159 | + background-color: var(--goa-temporary-notification-progress-bar-color-fill, white); |
| 160 | + border-radius: 0 0 var(--goa-temporary-notification-progress-bar-borderRadius, 0) var(--goa-temporary-notification-progress-bar-borderRadius, 0); |
| 161 | + } |
| 162 | +
|
| 163 | + progress::-moz-progress-bar { |
| 164 | + background-color: var(--goa-temporary-notification-progress-bar-color-fill, white); |
| 165 | + border-radius: 0 0 var(--goa-temporary-notification-progress-bar-borderRadius, 0) var(--goa-temporary-notification-progress-bar-borderRadius, 0); |
127 | 166 | } |
128 | 167 |
|
129 | 168 | .show { |
|
143 | 182 | } |
144 | 183 |
|
145 | 184 | .hide.animate-up { |
146 | | - transform: translateY(-100px); |
| 185 | + transform: translateY(calc(-1 * var(--goa-temporary-notification-animation-distance, 100px))); |
147 | 186 | } |
148 | 187 |
|
149 | 188 | .hide.animate-down { |
150 | | - transform: translateY(100px); |
| 189 | + transform: translateY(var(--goa-temporary-notification-animation-distance, 100px)); |
151 | 190 | } |
152 | 191 |
|
153 | 192 | .snackbar.success { |
154 | | - background: var(--goa-color-success-default); |
| 193 | + background: var(--goa-temporary-notification-color-bg-success, var(--goa-color-success-default)); |
155 | 194 | } |
156 | 195 |
|
157 | 196 | .snackbar.failure { |
158 | | - background: var(--goa-color-emergency-default); |
| 197 | + background: var(--goa-temporary-notification-color-bg-failure, var(--goa-color-emergency-default)); |
159 | 198 | } |
160 | 199 |
|
161 | 200 | .message { |
162 | 201 | flex: 1 1 auto; |
163 | | - font: var(--goa-typography-body-m); |
| 202 | + font: var(--goa-temporary-notification-typography, var(--goa-typography-body-m)); |
| 203 | + } |
| 204 | +
|
| 205 | + /* Add top margin to message when icon is present to vertically center first line with icon */ |
| 206 | + .content:has(goa-icon) .message { |
| 207 | + margin-top: var(--goa-temporary-notification-padding-text-top, var(--goa-space-2xs)); |
164 | 208 | } |
165 | 209 | </style> |
0 commit comments