@@ -22,8 +22,8 @@ import {
2222} from '@/components/ui/select' ;
2323import type { Component } from '../types/component' ;
2424
25- // Predefined tag options for components
26- const TAG_OPTIONS : Option [ ] = [
25+ // Predefined category options for components
26+ const CATEGORY_OPTIONS : Option [ ] = [
2727 { value : 'header' , label : 'Header' } ,
2828 { value : 'hero' , label : 'Hero' } ,
2929 { value : 'navigation' , label : 'Navigation' } ,
@@ -80,14 +80,14 @@ const TAG_OPTIONS: Option[] = [
8080const componentSchema = z . object ( {
8181 name : z . string ( ) . min ( 1 , 'Name is required' ) ,
8282 type : z . enum ( [ 'blocks' , 'templates' ] ) ,
83- tags : z
83+ categories : z
8484 . array (
8585 z . object ( {
8686 value : z . string ( ) ,
8787 label : z . string ( )
8888 } )
8989 )
90- . min ( 1 , 'At least one tag is required' ) ,
90+ . min ( 1 , 'At least one category is required' ) ,
9191 author : z . string ( ) . min ( 1 , 'Author is required' )
9292} ) ;
9393
@@ -118,34 +118,34 @@ export function ComponentForm({
118118 defaultValues : {
119119 name : editingComponent ?. metadata . name || '' ,
120120 type : editingComponent ?. type || 'blocks' ,
121- tags :
122- editingComponent ?. metadata . tags ?. map ( ( tag ) => ( {
123- value : tag ,
124- label : tag . charAt ( 0 ) . toUpperCase ( ) + tag . slice ( 1 )
121+ categories :
122+ editingComponent ?. metadata . categories ?. map ( ( category ) => ( {
123+ value : category ,
124+ label : category . charAt ( 0 ) . toUpperCase ( ) + category . slice ( 1 )
125125 } ) ) || [ ] ,
126126 author : editingComponent ?. metadata . author || ''
127127 }
128128 } ) ;
129129
130130 const watchedType = watch ( 'type' ) ;
131- const watchedTags = watch ( 'tags ' ) ;
131+ const watchedCategories = watch ( 'categories ' ) ;
132132
133133 React . useEffect ( ( ) => {
134134 if ( editingComponent ) {
135135 reset ( {
136136 name : editingComponent . metadata . name ,
137137 type : editingComponent . type ,
138- tags : editingComponent . metadata . tags . map ( ( tag ) => ( {
139- value : tag ,
140- label : tag . charAt ( 0 ) . toUpperCase ( ) + tag . slice ( 1 )
138+ categories : editingComponent . metadata . categories . map ( ( category ) => ( {
139+ value : category ,
140+ label : category . charAt ( 0 ) . toUpperCase ( ) + category . slice ( 1 )
141141 } ) ) ,
142142 author : editingComponent . metadata . author
143143 } ) ;
144144 } else {
145145 reset ( {
146146 name : '' ,
147147 type : 'blocks' ,
148- tags : [ ] ,
148+ categories : [ ] ,
149149 author : ''
150150 } ) ;
151151 }
@@ -159,7 +159,7 @@ export function ComponentForm({
159159 metadata : {
160160 id : newId ,
161161 name : data . name ,
162- tags : data . tags . map ( ( tag ) => tag . value ) ,
162+ categories : data . categories . map ( ( category ) => category . value ) ,
163163 author : data . author
164164 } ,
165165 html : '<div class="p-4 bg-gray-100 rounded-lg">\n <!-- Start building your component here -->\n <p class="text-gray-600">Your component content goes here...</p>\n</div>' ,
@@ -223,25 +223,27 @@ export function ComponentForm({
223223 </ div >
224224
225225 < div >
226- < Label htmlFor = "tags" > Tags </ Label >
226+ < Label htmlFor = "categories" > Categories </ Label >
227227 < MultipleSelector
228- value = { watchedTags as Option [ ] }
229- onChange = { ( options ) => setValue ( 'tags ' , options ) }
230- defaultOptions = { TAG_OPTIONS }
231- placeholder = "Select tags for your component..."
228+ value = { watchedCategories as Option [ ] }
229+ onChange = { ( options ) => setValue ( 'categories ' , options ) }
230+ defaultOptions = { CATEGORY_OPTIONS }
231+ placeholder = "Select categories for your component..."
232232 emptyIndicator = {
233233 < p className = "text-center text-sm leading-10 text-muted-foreground" >
234- No tags found.
234+ No categories found.
235235 </ p >
236236 }
237237 className = "mt-1"
238238 maxSelected = { 4 }
239239 onMaxSelected = { ( maxLimit ) => {
240- console . log ( `You can select up to ${ maxLimit } tags ` ) ;
240+ console . log ( `You can select up to ${ maxLimit } categories ` ) ;
241241 } }
242242 />
243- { errors . tags && (
244- < p className = "text-sm text-red-500 mt-1" > { errors . tags . message } </ p >
243+ { errors . categories && (
244+ < p className = "text-sm text-red-500 mt-1" >
245+ { errors . categories . message }
246+ </ p >
245247 ) }
246248 </ div >
247249
0 commit comments