5656 </lf-field >
5757 </article >
5858
59- <!-- Logo URL -->
60- <article class =" mb-6" >
61- <lf-field label-text =" Logo URL" >
62- <lf-input
63- v-model =" form.logoUrl"
64- class =" h-10"
65- placeholder =" https://example.com/logo.png"
66- :invalid =" $v.logoUrl.$invalid && $v.logoUrl.$dirty"
67- @blur =" $v.logoUrl.$touch()"
68- @change =" $v.logoUrl.$touch()"
69- />
70- <lf-field-messages
71- :validation =" $v.logoUrl"
72- :error-messages =" { url: 'Please enter a valid URL' }"
73- />
74- </lf-field >
75- </article >
59+ <!-- Appearance section -->
60+ <div class =" mb-6" >
61+ <h6 class =" text-sm font-semibold text-gray-500 mb-4 border-b border-gray-100 pb-2" >
62+ Appearance
63+ </h6 >
64+
65+ <!-- Card image URL -->
66+ <article class =" mb-6" >
67+ <lf-field label-text =" Card image URL" :required =" true" >
68+ <lf-input
69+ v-model =" form.imageUrl"
70+ class =" h-10"
71+ placeholder =" https://example.com/card-image.png"
72+ :invalid =" $v.imageUrl.$invalid && $v.imageUrl.$dirty"
73+ @blur =" $v.imageUrl.$touch()"
74+ @change =" $v.imageUrl.$touch()"
75+ />
76+ <lf-field-messages
77+ :validation =" $v.imageUrl"
78+ :error-messages =" { url: 'Please enter a valid URL' }"
79+ />
80+ <span class =" text-2xs text-gray-400" >Recommended image size: 800×240px</span >
81+ </lf-field >
82+ </article >
83+
84+ <!-- Collection logo URL -->
85+ <article class =" mb-6" >
86+ <lf-field label-text =" Collection logo URL" :required =" true" >
87+ <lf-input
88+ v-model =" form.logoUrl"
89+ class =" h-10"
90+ placeholder =" https://example.com/logo.png"
91+ :invalid =" $v.logoUrl.$invalid && $v.logoUrl.$dirty"
92+ @blur =" $v.logoUrl.$touch()"
93+ @change =" $v.logoUrl.$touch()"
94+ />
95+ <lf-field-messages
96+ :validation =" $v.logoUrl"
97+ :error-messages =" { url: 'Please enter a valid URL' }"
98+ />
99+ <span class =" text-2xs text-gray-400" >Recommended image size: 400×400px</span >
100+ </lf-field >
101+ </article >
102+
103+ <!-- Collection color -->
104+ <article class =" mb-6" >
105+ <lf-field label-text =" Collection color" >
106+ <div class =" flex items-center gap-2" >
107+ <span
108+ class =" w-6 h-6 rounded-full flex-shrink-0 border border-gray-200"
109+ :style =" { backgroundColor: form.color || '#009AFF' }"
110+ />
111+ <lf-input
112+ v-model =" form.color"
113+ class =" h-10 flex-grow"
114+ placeholder =" #FE9A00"
115+ type =" color"
116+ />
117+ </div >
118+ <span class =" text-2xs text-gray-400" >Leave blank to use the default color #009AFF</span >
119+ </lf-field >
120+ </article >
121+ </div >
76122
77123 <!-- Category -->
78124 <article class =" mb-5" >
@@ -204,6 +250,8 @@ const form = reactive<CollectionFormModel>({
204250 type: ' ' ,
205251 categoryId: null ,
206252 logoUrl: ' ' ,
253+ imageUrl: ' ' ,
254+ color: ' ' ,
207255 projects: [],
208256 starred: false ,
209257});
@@ -214,6 +262,7 @@ const rules = {
214262 maxLength ,
215263 },
216264 description: { required : (value : string ) => value .trim ().length },
265+ imageUrl: { url },
217266 logoUrl: { url },
218267 projects: { required : (value : any ) => value .length > 0 },
219268};
@@ -239,6 +288,8 @@ const fillForm = (record?: CollectionModel) => {
239288 form .type = record .category ?.categoryGroupType ;
240289 form .categoryId = record .categoryId || null ;
241290 form .logoUrl = record .logoUrl || ' ' ;
291+ form .imageUrl = record .imageUrl || ' ' ;
292+ form .color = record .color || ' ' ;
242293 }
243294
244295 formSnapshot ();
@@ -263,6 +314,8 @@ const onSubmit = () => {
263314 name: form .name ,
264315 description: form .description ,
265316 logoUrl: form .logoUrl || undefined ,
317+ imageUrl: form .imageUrl || undefined ,
318+ color: form .color || undefined ,
266319 projects: form .projects .map ((project : any ) => ({
267320 id: project .id ,
268321 starred: project ?.starred || false ,
0 commit comments