@@ -13,18 +13,15 @@ const emit = defineEmits<{
1313 delete: []
1414}>()
1515
16- const coverUrl = ref < string | null >( null )
16+ const previewHtml = ref ( ' ' )
1717const loading = ref (true )
1818
1919onMounted (async () => {
2020 try {
21- const res = await fetch (` /api/screenshot?t=${props .template .id } ` )
22- if (res .ok ) {
23- const data = await res .json ()
24- coverUrl .value = data .url
25- }
21+ const res = await fetch (` /api/render/html?t=${props .template .id } ` )
22+ if (res .ok ) previewHtml .value = await res .text ()
2623 } catch {
27- // fallback: no cover image
24+ // no preview
2825 } finally {
2926 loading .value = false
3027 }
@@ -33,15 +30,9 @@ onMounted(async () => {
3330
3431<template >
3532 <div class =" template-card" >
36- <!-- Preview thumbnail as image -->
3733 <div class =" template-card__preview" >
38- <div v-if =" loading" class =" template-card__loading" >Loading...</div >
39- <img
40- v-else-if =" coverUrl"
41- :src =" coverUrl"
42- :alt =" template.name"
43- class =" template-card__cover"
44- />
34+ <div v-if =" loading" class =" template-card__placeholder" >Loading...</div >
35+ <div v-else-if =" previewHtml" class =" template-card__render" v-html =" previewHtml" />
4536 <div v-else class =" template-card__placeholder" >No preview</div >
4637 </div >
4738
@@ -53,7 +44,7 @@ onMounted(async () => {
5344
5445 <div class =" template-card__meta" >
5546 <span class =" template-card__detail" >{{ template.size }}</span >
56- <span class =" template-card__sep" >· </span >
47+ <span class =" template-card__sep" >& middot ; </span >
5748 <span class =" template-card__detail" >{{ template.brand }}</span >
5849 </div >
5950
@@ -84,15 +75,17 @@ onMounted(async () => {
8475 background : var (--mp-bg3 );
8576 overflow : hidden ;
8677 position : relative ;
78+ display : flex ;
79+ align-items : center ;
80+ justify-content : center ;
8781}
8882
89- .template-card__cover {
90- width : 100 % ;
91- height : 100 % ;
92- object-fit : cover ;
83+ .template-card__render {
84+ zoom : 0.25 ;
85+ pointer-events : none ;
86+ transform-origin : center center ;
9387}
9488
95- .template-card__loading ,
9689.template-card__placeholder {
9790 display : flex ;
9891 align-items : center ;
0 commit comments