@economist/component-blog-post
Advanced tools
Comparing version 1.4.1 to 1.5.0
56
index.js
@@ -19,2 +19,6 @@ 'use strict'; | ||
var _urlJoin = require('url-join'); | ||
var _urlJoin2 = _interopRequireDefault(_urlJoin); | ||
var BlogPost = (function (_React$Component) { | ||
@@ -55,3 +59,3 @@ _inherits(BlogPost, _React$Component); | ||
content.push(_react2['default'].createElement( | ||
'div', | ||
'p', | ||
{ | ||
@@ -66,2 +70,10 @@ className: 'blog-post__rubric', | ||
if (this.props.image && this.props.image.src) { | ||
var caption = null; | ||
if (this.props.image.caption) { | ||
caption = _react2['default'].createElement( | ||
'figcaption', | ||
{ className: 'blog-post__image-caption' }, | ||
this.props.image.caption | ||
); | ||
} | ||
content.push(_react2['default'].createElement( | ||
@@ -75,3 +87,4 @@ 'figure', | ||
className: 'blog-post__image-block' | ||
})) | ||
})), | ||
caption | ||
)); | ||
@@ -81,2 +94,17 @@ } | ||
if (this.props.section) { | ||
var sectionUrl = this.props.sectionUrl; | ||
if (sectionUrl) { | ||
if (!/^(\w+:)?\/\//.test(sectionUrl)) { | ||
sectionUrl = _urlJoin2['default']('/', sectionUrl); | ||
} | ||
} | ||
var section = sectionUrl ? _react2['default'].createElement( | ||
'a', | ||
{ | ||
href: sectionUrl, | ||
className: 'blog-post__section-link' | ||
}, | ||
this.props.section | ||
) : this.props.section; | ||
asideableContent.push(_react2['default'].createElement( | ||
@@ -89,3 +117,3 @@ 'h3', | ||
}, | ||
this.props.section | ||
section | ||
)); | ||
@@ -105,6 +133,21 @@ } | ||
} | ||
if (this.props.byline) { | ||
asideableContent.push(_react2['default'].createElement( | ||
'p', | ||
{ className: 'blog-post__byline-container', key: 'blog-post__byline-container' }, | ||
"by ", | ||
_react2['default'].createElement( | ||
'span', | ||
{ | ||
className: 'blog-post__byline', | ||
itemProp: 'author' | ||
}, | ||
this.props.byline | ||
) | ||
)); | ||
} | ||
if (asideableContent.length) { | ||
content.push(_react2['default'].createElement( | ||
'div', | ||
{ className: 'blog-post__asideable-content blog-post__asideable-content--meta' }, | ||
{ className: 'blog-post__asideable-content blog-post__asideable-content--meta', key: 'asideable-content' }, | ||
asideableContent | ||
@@ -161,6 +204,9 @@ )); | ||
image: _react2['default'].PropTypes.shape({ | ||
src: _react2['default'].PropTypes.string | ||
src: _react2['default'].PropTypes.string, | ||
caption: _react2['default'].PropTypes.string | ||
}), | ||
author: _react2['default'].PropTypes.string, | ||
byline: _react2['default'].PropTypes.string, | ||
section: _react2['default'].PropTypes.string, | ||
sectionUrl: _react2['default'].PropTypes.string, | ||
flyTitle: _react2['default'].PropTypes.string, | ||
@@ -167,0 +213,0 @@ title: _react2['default'].PropTypes.string.isRequired, |
{ | ||
"name": "@economist/component-blog-post", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "Blog post", | ||
@@ -132,3 +132,4 @@ "author": "The Economist (http://economist.com)", | ||
"@economist/component-palette": "^1.1.3", | ||
"@economist/component-typography": "^1.1.3" | ||
"@economist/component-typography": "^1.1.3", | ||
"url-join": "0.0.1" | ||
}, | ||
@@ -151,4 +152,5 @@ "devDependencies": { | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^0.2.1", | ||
"karma-mocha": "^0.2.0", | ||
"karma-sauce-launcher": "^0.2.14", | ||
"karma-sauce-launcher": "^0.3.0", | ||
"mocha": "^2.2.5", | ||
@@ -155,0 +157,0 @@ "npm-watch": "0.0.1", |
@@ -16,3 +16,2 @@ # component-blog-post | ||
--blog-post-background-color-datetime: purple; | ||
--blog-post-color-meta-separator: red; | ||
@@ -23,7 +22,12 @@ --blog-post-flytitle-spacing: 10px; | ||
--blog-post-section-spacing: 20px; | ||
--blog-post-image-spacing: 20px; | ||
--blog-post-meta-spacing: 20px; | ||
--blog-post-text-top-margin: 10px; | ||
--blog-post-text-top-margin: 10px; | ||
--blog-post-color-link-visited: pink; | ||
--blog-post-color-blockquote: gray; | ||
--blog-post-color-blockquote-quotes: red; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
51694
617
32
5
25
1
+ Addedurl-join@0.0.1
+ Addedurl-join@0.0.1(transitive)