Merge pull request #2 from CoreyGinnivan/JakeGinnivan-patch-2
Show more descriptive toast
This commit is contained in:
commit
c32770009b
|
@ -243,7 +243,7 @@
|
|||
`.svg`"
|
||||
x-bind:download="downloadType === 'download-svg' && item.icon_name"
|
||||
class="flex flex-col relative items-center group justify-center text-gray-700 rounded shadow hover:shadow-xl bg-white cursor-pointer transition duration-150 ease-in-out h-32 md:h-40"
|
||||
@click="handleClick(item, downloadType, $event), $dispatch('show:toast', item.icon_name), setTimeout(() => $dispatch('show:toast', false), 1000)"
|
||||
@click="handleClick(item, downloadType, $event, $dispatch)"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
|
@ -260,7 +260,15 @@
|
|||
x-transition:leave-start="opacity-100 transform scale-100"
|
||||
x-transition:leave-end="opacity-0 transform scale-90"
|
||||
>
|
||||
Copied
|
||||
<template x-if="downloadType == 'download-svg'"
|
||||
><span>Downloading!</span></template
|
||||
>
|
||||
<template x-if="downloadType == 'copy-cdn'"
|
||||
><span>Copied URL</span></template
|
||||
>
|
||||
<template x-if="downloadType == 'copy-svg'"
|
||||
><span>Copied SVG Code</span></template
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<img
|
||||
|
@ -1421,7 +1429,7 @@
|
|||
.includes(this.search.toLowerCase());
|
||||
});
|
||||
},
|
||||
handleClick(item, downloadType, event) {
|
||||
handleClick(item, downloadType, event, $dispatch) {
|
||||
if (downloadType === "copy-svg") {
|
||||
event.preventDefault();
|
||||
var url =
|
||||
|
@ -1435,6 +1443,8 @@
|
|||
if (response.ok) {
|
||||
response.text().then(function (svg) {
|
||||
navigator.clipboard.writeText(svg);
|
||||
$dispatch("show:toast", item.icon_name);
|
||||
setTimeout(() => $dispatch("show:toast", false), 1000);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1449,6 +1459,12 @@
|
|||
item.icon_path +
|
||||
`.svg`;
|
||||
navigator.clipboard.writeText(url);
|
||||
|
||||
$dispatch("show:toast", item.icon_name);
|
||||
setTimeout(() => $dispatch("show:toast", false), 1000);
|
||||
} else {
|
||||
$dispatch("show:toast", item.icon_name);
|
||||
setTimeout(() => $dispatch("show:toast", false), 1000);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue