Skip to content

Commit 99727d4

Browse files
committed
fix(button): clean up code, add href to roundrect for outlook clients
1 parent 1c8a81a commit 99727d4

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

packages/jsx-email/src/components/button.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const Button: JsxEmailComponent<ButtonProps> = ({
3232
fontSize = 16,
3333
align = 'left',
3434
withBackground = false,
35-
rel,
3635
...props
3736
}) => {
3837
// Logic for arcsize
@@ -72,7 +71,6 @@ export const Button: JsxEmailComponent<ButtonProps> = ({
7271

7372
const baseButton = (
7473
<a
75-
rel={rel}
7674
href={href}
7775
style={{
7876
...baseStyles,
@@ -85,20 +83,6 @@ export const Button: JsxEmailComponent<ButtonProps> = ({
8583
{children}
8684
</a>
8785
);
88-
const vmlFallbackLinkContents = (
89-
<a
90-
rel={rel}
91-
href={href}
92-
style={{
93-
color: textColor,
94-
...baseStyles,
95-
...style
96-
}}
97-
{...props}
98-
>
99-
{children}
100-
</a>
101-
);
10286

10387
return (
10488
<table
@@ -117,16 +101,14 @@ export const Button: JsxEmailComponent<ButtonProps> = ({
117101
<span
118102
dangerouslySetInnerHTML={{
119103
__html: `<!--[if mso]>
120-
<v:roundrect ${
121-
rel ? `rel="${rel}" ` : ''
122-
}href="${href}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" style="height:${height}px;v-text-anchor:middle;width:${width}px;" arcsize="${arcsize}%" ${
104+
<v:roundrect href="${href}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" style="height:${height}px;v-text-anchor:middle;width:${width}px;" arcsize="${arcsize}%" ${
123105
borderColor ? `strokecolor=${borderColor}` : ''
124106
} ${borderSize ? `strokeweight="${borderSize}px"` : `stroke="false"`} ${
125107
backgroundColor ? `fillcolor=${backgroundColor}` : `fill="false"`
126108
}>
127109
<w:anchorlock/>
128110
<center style="font-size:${fontSize}px;${textColor ? `color:${textColor};` : ''}">
129-
${vmlFallbackLinkContents}
111+
${children}
130112
</center></v:roundrect>
131113
<![endif]-->`
132114
}}

0 commit comments

Comments
 (0)