@@ -18,7 +18,7 @@ const handleClick = btn => {
18
18
selected = btn .name
19
19
code = btn .code
20
20
btn .run ()
21
- gtag (' event' , ` toast: ${ camelCase ( btn .name ) } ` )
21
+ gtag (' event' , ' toast' , { event_label : btn .name } )
22
22
}
23
23
24
24
const buttons = [
@@ -145,6 +145,7 @@ toast.set(id, { progress: 1 })`,
145
145
--toastProgressBackground: aquamarine;
146
146
}
147
147
</style>
148
+
148
149
<script>
149
150
toast.push('Changed some colors')
150
151
<\/ script>` , // eslint-disable-line no-useless-escape
@@ -156,12 +157,12 @@ toast.set(id, { progress: 1 })`,
156
157
{
157
158
name: ' POSITION TO BOTTOM' ,
158
159
code: ` <style>
159
- :root {
160
- --toastContainerTop: auto;
161
- --toastContainerRight: auto;
162
- --toastContainerBottom: 8rem;
163
- --toastContainerLeft: calc(50vw - 8rem);
164
- }
160
+ :root {
161
+ --toastContainerTop: auto;
162
+ --toastContainerRight: auto;
163
+ --toastContainerBottom: 8rem;
164
+ --toastContainerLeft: calc(50vw - 8rem);
165
+ }
165
166
</style>
166
167
167
168
<SvelteToast options={{ reversed: true, intro: { y: 192 } }} />
@@ -176,28 +177,6 @@ toast.set(id, { progress: 1 })`,
176
177
toast .push (' Bottoms up!' )
177
178
}
178
179
},
179
- {
180
- name: ' USE COMPONENT' ,
181
- code: `
182
- toast.push({
183
- component: {
184
- src: DummyComponent,
185
- props: {
186
- foo: 'bar'
187
- }
188
- }
189
- })` ,
190
- run: async () => {
191
- toast .push ({
192
- component: {
193
- src: DummyComponent,
194
- props: {
195
- foo: ' bar'
196
- }
197
- }
198
- })
199
- }
200
- },
201
180
{
202
181
name: ' RESTORE DEFAULTS' ,
203
182
code: ' // All default settings restored!' ,
@@ -229,19 +208,12 @@ toast.set(id, { progress: 1 })`,
229
208
<SvelteToast target="new" options={{ initial: 0, intro: { y: -64 } }} />
230
209
</div>
231
210
232
- <div>
233
- <SvelteToast options={{ initial: 0, intro: { y: -64 } }} />
234
- </div>
235
-
236
211
<script>
237
212
// Send toast to "new" container
238
- toast.push('NEW: Multiple toast container support', { target: 'new' });
239
- // Send toast to "default" container
240
- toast.push('Default container toast')
213
+ toast.push('NEW: Multiple toast container support', { target: 'new' })
241
214
<\/ script>` , // eslint-disable-line no-useless-escape
242
215
run : () => {
243
216
toast .push (' NEW: Multiple toast container support' , { target: ' new' })
244
- toast .push (' Default container toast' )
245
217
}
246
218
},
247
219
{
@@ -254,6 +226,37 @@ toast.pop(0)`,
254
226
run : () => {
255
227
toast .pop (i => i .target !== ' new' )
256
228
}
229
+ },
230
+ {
231
+ name: ' SEND COMPONENT AS A MESSAGE' ,
232
+ code: ` toast.push({
233
+ component: {
234
+ src: DummyComponent,
235
+ props: {
236
+ title: 'A Dummy Cookie Component'
237
+ }
238
+ },
239
+ dismissable: false,
240
+ initial: 0,
241
+ theme: {
242
+ '--toastMsgPadding': '0'
243
+ }
244
+ })` ,
245
+ run : () => {
246
+ toast .push ({
247
+ component: {
248
+ src: DummyComponent,
249
+ props: {
250
+ title: ' A Dummy Cookie Component'
251
+ }
252
+ },
253
+ dismissable: false ,
254
+ initial: 0 ,
255
+ theme: {
256
+ ' --toastMsgPadding' : ' 0'
257
+ }
258
+ })
259
+ }
257
260
}
258
261
]
259
262
</script >
@@ -282,32 +285,29 @@ toast.pop(0)`,
282
285
font-size : 0.875rem ;
283
286
}
284
287
</style >
285
-
286
- <div class =" container" >
287
- <div class =" w-full h-64 px-2 mt-4 mb-8" >
288
- <Prism classes =" w-full h-full bg-gray-700 text-gray-200 font-mono shadow rounded-sm overflow-scroll p-4" >
289
- {code }
290
- </Prism >
291
- </div >
292
-
293
- <div class =" flex flex-row flex-wrap items-center justify-center" >
294
-
295
- {#each buttons as btn }
296
- <button
297
- class:selected ={selected === btn .name }
298
- on:click ={() => { handleClick (btn ) }}
299
- data-btn ={camelCase (btn .name )}>
300
- {btn .name }
301
- </button >
302
- {/each }
303
-
304
- </div >
288
+
289
+ <div class =" container" >
290
+ <div class =" w-full h-64 px-2 mt-4 mb-8" >
291
+ <Prism classes =" w-full h-full bg-gray-700 text-gray-200 font-mono shadow rounded-sm overflow-scroll p-4" >
292
+ {code }
293
+ </Prism >
305
294
</div >
306
-
307
- <div class =" top" >
308
- <SvelteToast options ={{ initial : 0 , intro : { y : - 64 } }} target =" new" />
295
+ <div class =" flex flex-row flex-wrap items-center justify-center" >
296
+ {#each buttons as btn }
297
+ <button
298
+ class:selected ={selected === btn .name }
299
+ on:click ={() => { handleClick (btn ) }}
300
+ data-btn ={camelCase (btn .name )}>
301
+ {btn .name }
302
+ </button >
303
+ {/each }
309
304
</div >
310
-
311
- <div class:colors class:bottom >
312
- <SvelteToast {options } />
313
- </div >
305
+ </div >
306
+
307
+ <div class =" top" >
308
+ <SvelteToast options ={{ initial : 0 , intro : { y : - 64 } }} target =" new" />
309
+ </div >
310
+
311
+ <div class:colors class:bottom >
312
+ <SvelteToast {options } />
313
+ </div >
0 commit comments