@@ -176,9 +176,13 @@ export function registerCodegen(ctx: typeof figma) {
176176 console . info ( `[benchmark] devup-ui end ${ Date . now ( ) - time } ms` )
177177
178178 // Check if node itself is SECTION or has a parent SECTION
179- const sectionNode = ResponsiveCodegen . canGenerateResponsive ( node )
179+ const isNodeSection = ResponsiveCodegen . canGenerateResponsive ( node )
180+ const parentSection = ResponsiveCodegen . hasParentSection ( node )
181+ const sectionNode = isNodeSection
180182 ? ( node as SectionNode )
181- : ResponsiveCodegen . hasParentSection ( node )
183+ : parentSection
184+ // When parent is Section (not node itself), use Page postfix and export default
185+ const isParentSection = ! isNodeSection && parentSection !== null
182186 let responsiveResult : {
183187 title : string
184188 language : 'TYPESCRIPT' | 'BASH'
@@ -190,10 +194,14 @@ export function registerCodegen(ctx: typeof figma) {
190194 const responsiveCodegen = new ResponsiveCodegen ( sectionNode )
191195 const responsiveCode =
192196 await responsiveCodegen . generateResponsiveCode ( )
193- const sectionComponentName = toPascal ( sectionNode . name )
197+ const baseName = toPascal ( sectionNode . name )
198+ const sectionComponentName = isParentSection
199+ ? `${ baseName } Page`
200+ : baseName
194201 const wrappedCode = wrapComponent (
195202 sectionComponentName ,
196203 responsiveCode ,
204+ { exportDefault : isParentSection } ,
197205 )
198206 const sectionCodes : ReadonlyArray < readonly [ string , string ] > = [
199207 [ sectionComponentName , wrappedCode ] ,
0 commit comments