Skip to content

Commit 121b26f

Browse files
committed
Fix Text with box shadow
1 parent e647329 commit 121b26f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ exports[`Codegen renders text node with ellipsis props 1`] = `
392392

393393
exports[`Codegen renders text node with single drop shadow 1`] = `
394394
"<Text
395-
boxShadow="2px 4px 6px 0 #00000080"
396395
boxSize="100%"
397396
color="#F00"
398397
fontFamily="Arial"
@@ -408,7 +407,6 @@ exports[`Codegen renders text node with single drop shadow 1`] = `
408407

409408
exports[`Codegen renders text node with multiple drop shadows 1`] = `
410409
"<Text
411-
boxShadow="1px 2px 3px 0 #F00, 4px 5px 6px 0 #0F0C"
412410
boxSize="100%"
413411
color="#F00"
414412
fontFamily="Arial"
@@ -3331,7 +3329,6 @@ exports[`render real world component real world $ 99`] = `
33313329
return (
33323330
<Text
33333331
WebkitTextStroke="3px #FFF"
3334-
boxShadow="0 0 12px 0 #7C70FF"
33353332
color="#4C05FF"
33363333
fontFamily="Jalnan 2 TTF"
33373334
fontSize="38px"
@@ -3394,7 +3391,6 @@ exports[`render real world component real world $ 102`] = `
33943391
return (
33953392
<Text
33963393
WebkitTextStroke="2px #FFF"
3397-
boxShadow="0 0 12px 0 #7C70FF, 0 10px 24px 0 #FFC9FE66"
33983394
color="transparent"
33993395
fontFamily="Jalnan Gothic TTF"
34003396
fontSize="64px"

src/codegen/props/effect.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ export function getEffectProps(
66
node: SceneNode,
77
): Record<string, string> | undefined {
88
if ('effects' in node && node.effects.length > 0) {
9-
return node.effects.reduce(
9+
// TEXT nodes use textShadow for DROP_SHADOW (handled by text-shadow.ts)
10+
const effects =
11+
node.type === 'TEXT'
12+
? node.effects.filter((e) => e.type !== 'DROP_SHADOW')
13+
: node.effects
14+
if (effects.length === 0) return
15+
return effects.reduce(
1016
(acc, effect) => {
1117
const props = _getEffectPropsFromEffect(effect)
1218
for (const [key, value] of Object.entries(props)) {

0 commit comments

Comments
 (0)