|
|
@@ -45,43 +45,32 @@
|
|
|
const paddingObj = { '0.5': ' p-0.5', '1': ' p-1', '2': ' p-2', '4': ' p-4' };
|
|
|
const randomArr = ['w-1/2', 'w-1/3', 'w-2/3', 'w-1/4', 'w-3/4', 'w-2/5', 'w-3/5', 'w-4/5', 'w-5/6'];
|
|
|
const typeIconFun = type => {
|
|
|
- switch (type) {
|
|
|
- case 'img':
|
|
|
- return 'ri-image-2-fill';
|
|
|
- case 'video':
|
|
|
- return 'ri-movie-2-fill';
|
|
|
- case 'code':
|
|
|
- return 'ri-code-box-fill';
|
|
|
- case 'qrcode':
|
|
|
- return 'ri-qr-code-fill';
|
|
|
- case 'barcode':
|
|
|
- return 'ri-barcode-fill';
|
|
|
- default:
|
|
|
- return 'ri-qr-code-fill';
|
|
|
- }
|
|
|
+ const typeMap = {
|
|
|
+ img: 'ri-image-2-fill',
|
|
|
+ video: 'ri-movie-2-fill',
|
|
|
+ code: 'ri-code-box-fill',
|
|
|
+ qrcode: 'ri-qr-code-fill',
|
|
|
+ barcode: 'ri-barcode-fill',
|
|
|
+ };
|
|
|
+ return typeMap[type] || typeMap.qrcode;
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<div class={`animate-pulse ${type === 'p' || width === 'full' ? 'block' : 'inline-block'}${paddingObj[space] || paddingObj['1']}`}>
|
|
|
+<div class="animate-pulse {type === 'p' || width === 'full' ? 'block' : 'inline-block'}{paddingObj[space] || paddingObj['1']}">
|
|
|
{#if type === 'p'}
|
|
|
<div class="flex flex-col space-y-2">
|
|
|
- <!-- eslint-disable-next-line no-unused-vars -->
|
|
|
{#each new Array(lines - 1) as item}
|
|
|
- <div
|
|
|
- class={`bg-black/20 dark:bg-white/20 w-full${heightObj[height] || heightObj['6']}${radiusObj[radius] || radiusObj.base}`}
|
|
|
- ></div>
|
|
|
+ <div class="bg-black/20 dark:bg-white/20 w-full{heightObj[height] || heightObj['6']}{radiusObj[radius] || radiusObj.base}"></div>
|
|
|
{/each}
|
|
|
<div
|
|
|
- class={`bg-black/20 dark:bg-white/20 ${randomArr[Math.floor(Math.random() * randomArr.length)]}${
|
|
|
- heightObj[height] || heightObj['6']
|
|
|
- }${radiusObj[radius] || radiusObj.base}`}
|
|
|
+ class="bg-black/20 dark:bg-white/20 {randomArr[Math.floor(Math.random() * randomArr.length)]}{heightObj[height] ||
|
|
|
+ heightObj['6']}{radiusObj[radius] || radiusObj.base}"
|
|
|
></div>
|
|
|
</div>
|
|
|
{:else}
|
|
|
<div
|
|
|
- class={`bg-black/20 dark:bg-white/20${widthObj[width] || widthObj.full}${heightObj[height] || heightObj['6']}${
|
|
|
- radiusObj[radius] || radiusObj.base
|
|
|
- } flex flex-col justify-center`}
|
|
|
+ class="bg-black/20 dark:bg-white/20{widthObj[width] || widthObj.full}{heightObj[height] || heightObj['6']}{radiusObj[radius] ||
|
|
|
+ radiusObj.base} flex flex-col justify-center"
|
|
|
>
|
|
|
{#if type === 'img' || type === 'video' || type === 'code' || type === 'qrcode' || type === 'barcode'}
|
|
|
<div class="m-auto" style="width:{iconRatio * 100 + '%'}">
|