Skip to content

Commit 5b43897

Browse files
committed
Fix space
1 parent 353c177 commit 5b43897

File tree

4 files changed

+32
-37
lines changed

4 files changed

+32
-37
lines changed

src/codegen/__tests__/__snapshots__/codegen.test.ts.snap

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,17 +2948,17 @@ exports[`render real world component real world $ 104`] = `
29482948
transition="0.3ms ease-out"
29492949
transitionProperty="background,box-shadow,opacity"
29502950
>
2951-
<Text
2952-
color="#FFF"
2953-
fontFamily="Pretendard"
2954-
fontSize="16px"
2955-
fontWeight="700"
2956-
letterSpacing="-0.04em"
2957-
lineHeight="1.4"
2958-
wordBreak="keep-all"
2959-
>
2960-
자세히 알아보기 →
2961-
</Text>
2951+
<Text
2952+
color="#FFF"
2953+
fontFamily="Pretendard"
2954+
fontSize="16px"
2955+
fontWeight="700"
2956+
letterSpacing="-0.04em"
2957+
lineHeight="1.4"
2958+
wordBreak="keep-all"
2959+
>
2960+
자세히 알아보기 →
2961+
</Text>
29622962
</Center>
29632963
)
29642964
}"
@@ -3005,23 +3005,23 @@ export function Button({ size, variant }: ButtonProps) {
30053005
transition="0.2ms ease-out"
30063006
transitionProperty="background"
30073007
>
3008-
<Text
3009-
color={{
3010-
primary: "#FFF",
3011-
white: "$primaryAccent"
3012-
}[variant]}
3013-
fontFamily="Noto Sans KR"
3014-
fontSize={{
3015-
Md: ["16px", null, null, null, "20px"],
3016-
Sm: ["14px", null, null, null, "15px"]
3017-
}[size]}
3018-
fontWeight="500"
3019-
letterSpacing="-0.04em"
3020-
lineHeight="normal"
3021-
wordBreak="keep-all"
3022-
>
3023-
참가 신청하기
3024-
</Text>
3008+
<Text
3009+
color={{
3010+
primary: "#FFF",
3011+
white: "$primaryAccent"
3012+
}[variant]}
3013+
fontFamily="Noto Sans KR"
3014+
fontSize={{
3015+
Md: ["16px", null, null, null, "20px"],
3016+
Sm: ["14px", null, null, null, "15px"]
3017+
}[size]}
3018+
fontWeight="500"
3019+
letterSpacing="-0.04em"
3020+
lineHeight="normal"
3021+
wordBreak="keep-all"
3022+
>
3023+
참가 신청하기
3024+
</Text>
30253025
</Center>
30263026
)
30273027
}"

src/codegen/__tests__/render.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('renderNode', () => {
2929
props: { p: '8px' },
3030
deps: 1,
3131
children: ['<Text />'] as string[],
32-
expected: ' <Box p="8px">\n <Text />\n </Box>',
32+
expected: ' <Box p="8px">\n <Text />\n </Box>',
3333
},
3434
])('$title', ({ component, props, deps, children, expected }) => {
3535
const result = renderNode(component, props, deps, children)

src/codegen/render/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ export function renderNode(
2525
}`,
2626
hasChildren
2727
? childrenCodes
28-
.map(
29-
(child) =>
30-
space(deps + 1) + child.split('\n').join(`\n${space(deps + 1)}`),
31-
)
28+
.map((child) => space(1) + child.split('\n').join(`\n${space(1)}`))
3229
.join('\n')
3330
: '',
3431
tail,

src/codegen/responsive/ResponsiveCodegen.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class ResponsiveCodegen {
115115

116116
// If component has position props, wrap in Box
117117
if (Object.keys(mergedProps).length > 0) {
118-
const componentCode = renderNode(firstTree.component, {}, depth + 1, [])
118+
const componentCode = renderNode(firstTree.component, {}, 0, [])
119119
return renderNode('Box', mergedProps, depth, [componentCode])
120120
}
121121

@@ -139,9 +139,7 @@ export class ResponsiveCodegen {
139139
}
140140

141141
const innerCode =
142-
innerTrees.size > 0
143-
? this.generateMergedCode(innerTrees, depth + 1)
144-
: ''
142+
innerTrees.size > 0 ? this.generateMergedCode(innerTrees, 0) : ''
145143

146144
return renderNode('Box', mergedProps, depth, innerCode ? [innerCode] : [])
147145
}

0 commit comments

Comments
 (0)