Skip to content

Commit

Permalink
fix(button): clean up code, add href to roundrect for outlook clients
Browse files Browse the repository at this point in the history
  • Loading branch information
lordelogos committed Jan 7, 2025
1 parent 1c8a81a commit 99727d4
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions packages/jsx-email/src/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const Button: JsxEmailComponent<ButtonProps> = ({
fontSize = 16,
align = 'left',
withBackground = false,
rel,
...props
}) => {
// Logic for arcsize
Expand Down Expand Up @@ -72,7 +71,6 @@ export const Button: JsxEmailComponent<ButtonProps> = ({

const baseButton = (
<a
rel={rel}
href={href}
style={{
...baseStyles,
Expand All @@ -85,20 +83,6 @@ export const Button: JsxEmailComponent<ButtonProps> = ({
{children}
</a>
);
const vmlFallbackLinkContents = (
<a
rel={rel}
href={href}
style={{
color: textColor,
...baseStyles,
...style
}}
{...props}
>
{children}
</a>
);

return (
<table
Expand All @@ -117,16 +101,14 @@ export const Button: JsxEmailComponent<ButtonProps> = ({
<span
dangerouslySetInnerHTML={{
__html: `<!--[if mso]>
<v:roundrect ${
rel ? `rel="${rel}" ` : ''
}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}%" ${
<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}%" ${
borderColor ? `strokecolor=${borderColor}` : ''
} ${borderSize ? `strokeweight="${borderSize}px"` : `stroke="false"`} ${
backgroundColor ? `fillcolor=${backgroundColor}` : `fill="false"`
}>
<w:anchorlock/>
<center style="font-size:${fontSize}px;${textColor ? `color:${textColor};` : ''}">
${vmlFallbackLinkContents}
${children}
</center></v:roundrect>
<![endif]-->`
}}
Expand Down

0 comments on commit 99727d4

Please sign in to comment.