Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New property Email.heads for additional html heads #53

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions __tests__/renderEmail.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions examples/outlookKitchenSink.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'
import { Email, Item, Span } from '../src/index'

const heads = <meta httpEquiv="X-UA-Compatible" content="IE=edge" />

const email = (
<Email title="Test Email" heads={heads}>
<Item>
<Span fontSize={15}>Hello, world!</Span>
</Item>
</Email>
)

export default email
3 changes: 3 additions & 0 deletions src/components/Email.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function Email(props) {
<head>
<meta httpEquiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{props.heads}
<title>{props.title}</title>
{props.headCSS && <style type="text/css">{props.headCSS}</style>}
</head>
Expand Down Expand Up @@ -50,6 +51,7 @@ Email.propTypes = {
valign: PropTypes.oneOf(['top', 'middle', 'bottom']),
bodyStyle: EmailPropTypes.style,
children: PropTypes.node,
heads: PropTypes.node,
}

Email.defaultProps = {
Expand All @@ -64,4 +66,5 @@ Email.defaultProps = {
headCSS: undefined,
bodyStyle: undefined,
children: undefined,
heads: undefined,
}