fix: apply theme font size to email controls

This commit is contained in:
Admin 2026-09-23 07:01:34 +00:00
parent a331c2bb56
commit e2274c1ecb
2 changed files with 2 additions and 1 deletions

View File

@ -267,7 +267,7 @@ function emailBlock(block, data, theme) {
case 'kpi':
return `<mj-text padding="${padding}" color="${theme.mutedColor}" container-background-color="${backgroundColor}">${escapeHtml(interpolate(p.label, data))}</mj-text><mj-text padding="0 ${padding} ${padding}" color="${color}" font-size="22px" font-weight="700" container-background-color="${backgroundColor}">${escapeHtml(interpolate(p.value, data))}</mj-text>`
case 'button':
return `<mj-button background-color="${safeHex(style.backgroundColor, theme.accentColor)}" color="${safeHex(style.textColor, theme.buttonTextColor)}" border-radius="${radius}px" href="${escapeHtml(safeUrl(p.url, data))}">${escapeHtml(interpolate(p.text, data))}</mj-button>`
return `<mj-button background-color="${safeHex(style.backgroundColor, theme.accentColor)}" color="${safeHex(style.textColor, theme.buttonTextColor)}" font-size="${theme.baseFontSize}px" border-radius="${radius}px" href="${escapeHtml(safeUrl(p.url, data))}">${escapeHtml(interpolate(p.text, data))}</mj-button>`
case 'image':
return `<mj-image padding="${padding}" border="${borderWidth}px solid ${borderColor}" border-radius="${radius}px" src="${escapeHtml(safeUrl(p.url, data))}" alt="${escapeHtml(interpolate(p.alt, data))}" />`
case 'divider':

View File

@ -199,6 +199,7 @@ test('theme typography tokens drive email output', () => {
},
blocks: [
{ type: 'heading', props: { text: 'Heading' } },
{ type: 'text', props: { text: 'Body copy' } },
{ type: 'button', props: { text: 'Go', url: 'https://example.com' } }
]
}, {})