styled-email-components
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -36,2 +36,4 @@ 'use strict'; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
var InlineStyle = (0, _mailStyle2.default)(_stylesheet2.default); | ||
@@ -45,3 +47,3 @@ var constructWithOptions = (0, _constructWithOptions2.default)(_styledComponents.css); | ||
// Set html element aliases | ||
_domElements2.default.concat('center').forEach(function (element) { | ||
[].concat(_toConsumableArray(_domElements2.default), ['center', 'font']).forEach(function (element) { | ||
return Object.defineProperty(styled, element, { | ||
@@ -48,0 +50,0 @@ enumerable: true, |
{ | ||
"name": "styled-email-components", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "styled-components adopted for emails", | ||
@@ -5,0 +5,0 @@ "author": "Sergey Bekrin <sergey@bekrin.me>", |
@@ -27,3 +27,3 @@ import { | ||
// Set html element aliases | ||
domElements.concat('center').forEach(element => | ||
[...domElements, 'center', 'font'].forEach(element => | ||
Object.defineProperty(styled, element, { | ||
@@ -30,0 +30,0 @@ enumerable: true, |
@@ -90,3 +90,2 @@ import React from 'react'; | ||
render() { | ||
const { style } = this.props; | ||
const { generatedStyles } = this.state; | ||
@@ -97,3 +96,3 @@ const { target } = this.constructor; | ||
...this.props, | ||
style: [generatedStyles, style], | ||
style: [generatedStyles, this.attrs.style, this.props.style], | ||
}; | ||
@@ -100,0 +99,0 @@ const nextProps = Object.keys(props).reduce((acc, prop) => { |
@@ -119,3 +119,3 @@ import React from 'react'; | ||
it('merges with `style` prop', () => { | ||
it('overrides and merges styles by value from `style` prop', () => { | ||
const Link = styled.a` | ||
@@ -127,2 +127,14 @@ font-size: 16px; | ||
}); | ||
it('overrides and merges styles by value from `.attrs`', () => { | ||
const Link = styled.a.attrs({ | ||
style: { | ||
color: 'red', | ||
}, | ||
})` | ||
font-size: 16px; | ||
color: blue; | ||
`; | ||
expect(render(<Link />)).toMatchSnapshot(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
29232
591