fix(design-jsx): scale inline <svg> icons to their explicit w/h

<svg> icons always rendered at the 24px default because the size fell back
to 24 even when w/h were given. Prefer explicit w/h over the default so icon
content scales to fit its frame.
This commit is contained in:
Danila Poyarkov 2026-07-24 00:14:41 +03:00
parent 3cfc86371d
commit 49fa36ec12

View file

@ -251,7 +251,9 @@ async function renderSvgNode(
parentId: string
): Promise<SceneNode> {
const props = tree.props
const size = (props.size as number | undefined) ?? 24
const explicitW = typeof props.w === 'number' ? props.w : 0
const explicitH = typeof props.h === 'number' ? props.h : 0
const size = explicitW > 0 || explicitH > 0 ? Math.max(explicitW, explicitH) : ((props.size as number | undefined) ?? 24)
const colorHex = (props.color as string | undefined) ?? '#000000'
const parsedColor = parseColor(colorHex)