Skip to content

Add Row and Col components #33

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
lib
lib
.idea
35 changes: 35 additions & 0 deletions src/components/Col.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { PropTypes } from 'react'
import EmailPropTypes from '../PropTypes'
import includeDataProps from '../includeDataProps'

export default function Col(props) {
return (
<td {...includeDataProps(props)}
className={props.className}
align={props.align}
valign={props.valign}
bgcolor={props.bgcolor}
colSpan={props.colSpan}
style={props.style}>
{props.children}
</td>
)
}

Col.propTypes = {
className: PropTypes.string,
bgcolor: PropTypes.string,
colSpan: PropTypes.number,
align: PropTypes.oneOf(['left', 'center', 'right']),
valign: PropTypes.oneOf(['top', 'middle', 'bottom']),
style: EmailPropTypes.style,
children: PropTypes.node,
}

Col.defaultProps = {
className: null,
bgcolor: null,
align: 'center',
valign: 'top',
style: null,
}
33 changes: 33 additions & 0 deletions src/components/Row.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { PropTypes } from 'react'
import EmailPropTypes from '../PropTypes'
import includeDataProps from '../includeDataProps'

export default function Row(props) {
return (
<tr {...includeDataProps(props)}
className={props.className}
align={props.align}
valign={props.valign}
bgcolor={props.bgcolor}
style={props.style}>
{props.children}
</tr>
)
}

Row.propTypes = {
className: PropTypes.string,
bgcolor: PropTypes.string,
align: PropTypes.oneOf(['left', 'center', 'right']),
valign: PropTypes.oneOf(['top', 'middle', 'bottom']),
style: EmailPropTypes.style,
children: PropTypes.node,
}

Row.defaultProps = {
className: null,
bgcolor: null,
align: 'center',
valign: 'top',
style: null,
}
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Box from './components/Box'
import Email from './components/Email'
import Image from './components/Image'
import Item from './components/Item'
import Row from './components/Row'
import Col from './components/Col'
import Span from './components/Span'
import A from './components/A'
import injectReactEmailAttributes from './injectReactEmailAttributes'
Expand All @@ -20,6 +22,8 @@ export {
Email,
Image,
Item,
Row,
Col,
Span,
A,
injectReactEmailAttributes,
Expand Down