Skip to content

Commit 3e0b9fa

Browse files
committed
Allow fills/borders for text
1 parent 62dc50e commit 3e0b9fa

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

packages/elements-react/src/style/buildNodeCSS.ts

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -166,37 +166,34 @@ export function buildNodeCSS(
166166
cssStyle.paddingBottom = `${style.paddingBottom}px`;
167167
}
168168

169-
if (nodeType === "frame" || nodeType === "image" || nodeType === "svg") {
170-
const fills = style.fills;
171-
cssStyle.background = fills.length ? fills[0].solid : "transparent";
172-
cssStyle.borderStyle = "solid";
173-
cssStyle.borderColor =
174-
(style.border && style.border.solid) ?? "transparent";
175-
cssStyle.borderTopWidth = `${style.borderTopWidth}px`;
176-
cssStyle.borderRightWidth = `${style.borderRightWidth}px`;
177-
cssStyle.borderBottomWidth = `${style.borderBottomWidth}px`;
178-
cssStyle.borderLeftWidth = `${style.borderLeftWidth}px`;
179-
180-
cssStyle.borderTopLeftRadius = `${style.topLeftRadius}px`;
181-
cssStyle.borderTopRightRadius = `${style.topRightRadius}px`;
182-
cssStyle.borderBottomRightRadius = `${style.bottomRightRadius}px`;
183-
cssStyle.borderBottomLeftRadius = `${style.bottomLeftRadius}px`;
184-
185-
const shadows = style.shadows;
186-
if (shadows.length === 0) {
187-
cssStyle.boxShadow = "none";
188-
} else {
189-
cssStyle.boxShadow = shadows
190-
.map((shadow) => {
191-
const x = `${shadow.x}px`;
192-
const y = `${shadow.y}px`;
193-
const blur = `${shadow.blur}px`;
194-
const spread = `${shadow.spread}px`;
195-
const color = shadow.color;
196-
return `${x} ${y} ${blur} ${spread} ${color}`;
197-
})
198-
.join(", ");
199-
}
169+
const fills = style.fills;
170+
cssStyle.background = fills.length ? fills[0].solid : "transparent";
171+
cssStyle.borderStyle = "solid";
172+
cssStyle.borderColor = (style.border && style.border.solid) ?? "transparent";
173+
cssStyle.borderTopWidth = `${style.borderTopWidth}px`;
174+
cssStyle.borderRightWidth = `${style.borderRightWidth}px`;
175+
cssStyle.borderBottomWidth = `${style.borderBottomWidth}px`;
176+
cssStyle.borderLeftWidth = `${style.borderLeftWidth}px`;
177+
178+
cssStyle.borderTopLeftRadius = `${style.topLeftRadius}px`;
179+
cssStyle.borderTopRightRadius = `${style.topRightRadius}px`;
180+
cssStyle.borderBottomRightRadius = `${style.bottomRightRadius}px`;
181+
cssStyle.borderBottomLeftRadius = `${style.bottomLeftRadius}px`;
182+
183+
const shadows = style.shadows;
184+
if (shadows.length === 0) {
185+
cssStyle.boxShadow = "none";
186+
} else {
187+
cssStyle.boxShadow = shadows
188+
.map((shadow) => {
189+
const x = `${shadow.x}px`;
190+
const y = `${shadow.y}px`;
191+
const blur = `${shadow.blur}px`;
192+
const spread = `${shadow.spread}px`;
193+
const color = shadow.color;
194+
return `${x} ${y} ${blur} ${spread} ${color}`;
195+
})
196+
.join(", ");
200197
}
201198

202199
if (nodeType === "text") {

0 commit comments

Comments
 (0)