react-lorem-image
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -13,3 +13,8 @@ # Changelog | ||
## 1.1.0 | ||
* __New Feature__ | ||
* Cage added: [type: 'cage'] - http://www.placecage.com/ | ||
* Steven Segal added: [type: 'segal'] - http://www.stevensegallery.com/ | ||
## 1.0.0 | ||
* Initial Release |
@@ -13,4 +13,2 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
@@ -40,13 +38,4 @@ | ||
value: function render() { | ||
var _props = this.props; | ||
var type = _props.type; | ||
var height = _props.height; | ||
var width = _props.width; | ||
var color = _props.color; | ||
var mustache = _props.mustache; | ||
var rest = _objectWithoutProperties(_props, ['type', 'height', 'width', 'color', 'mustache']); | ||
var generated = (0, _utils.generateURL)({ type: type, height: height, width: width, color: color, mustache: mustache }); | ||
return _react2['default'].createElement('img', _extends({ | ||
var generated = (0, _utils.generateURL)(this.props); | ||
return _react2['default'].createElement('img', _extends({}, this.props, { | ||
alt: generated.type, | ||
@@ -56,3 +45,3 @@ src: generated.url, | ||
height: generated.height | ||
}, rest)); | ||
})); | ||
} | ||
@@ -66,3 +55,4 @@ }], [{ | ||
color: _react.PropTypes.bool, | ||
mustache: _react.PropTypes.bool | ||
mustache: _react.PropTypes.bool, | ||
crazy: _react.PropTypes.bool | ||
}, | ||
@@ -69,0 +59,0 @@ enumerable: true |
@@ -27,2 +27,19 @@ 'use strict'; | ||
return 'https://placekitten.com/' + (color ? '' : 'g/') + '' + width + '/' + height; | ||
}, | ||
segal: function segal(_ref4) { | ||
var width = _ref4.width; | ||
var height = _ref4.height; | ||
var color = _ref4.color; | ||
return 'http://www.stevensegallery.com/' + (color ? '' : 'g/') + '' + width + '/' + height; | ||
}, | ||
cage: function cage(_ref5) { | ||
var width = _ref5.width; | ||
var height = _ref5.height; | ||
var color = _ref5.color; | ||
var crazy = _ref5.crazy; | ||
var type = crazy ? 'c/' : !color ? 'g/' : ''; | ||
return 'http://www.placecage.com/' + type + '' + width + '/' + height; | ||
} | ||
@@ -41,16 +58,18 @@ }; | ||
function generateURL() { | ||
var _ref4 = arguments[0] === undefined ? {} : arguments[0]; | ||
var _ref6 = arguments[0] === undefined ? {} : arguments[0]; | ||
var _ref4$color = _ref4.color; | ||
var color = _ref4$color === undefined ? true : _ref4$color; | ||
var _ref4$width = _ref4.width; | ||
var width = _ref4$width === undefined ? 200 : _ref4$width; | ||
var _ref4$height = _ref4.height; | ||
var height = _ref4$height === undefined ? width : _ref4$height; | ||
var _ref4$mustache = _ref4.mustache; | ||
var mustache = _ref4$mustache === undefined ? false : _ref4$mustache; | ||
var _ref4$type = _ref4.type; | ||
var type = _ref4$type === undefined ? getRandom(TYPES) : _ref4$type; | ||
var _ref6$color = _ref6.color; | ||
var color = _ref6$color === undefined ? true : _ref6$color; | ||
var _ref6$width = _ref6.width; | ||
var width = _ref6$width === undefined ? 200 : _ref6$width; | ||
var _ref6$height = _ref6.height; | ||
var height = _ref6$height === undefined ? width : _ref6$height; | ||
var _ref6$mustache = _ref6.mustache; | ||
var mustache = _ref6$mustache === undefined ? false : _ref6$mustache; | ||
var _ref6$crazy = _ref6.crazy; | ||
var crazy = _ref6$crazy === undefined ? false : _ref6$crazy; | ||
var _ref6$type = _ref6.type; | ||
var type = _ref6$type === undefined ? getRandom(TYPES) : _ref6$type; | ||
var url = SERVICES[type]({ color: color, width: width, height: height }); | ||
var url = SERVICES[type]({ color: color, width: width, height: height, crazy: crazy }); | ||
return { | ||
@@ -57,0 +76,0 @@ type: type, |
@@ -10,10 +10,11 @@ import React, { PropTypes as Type } from 'react'; | ||
color: Type.bool, | ||
mustache: Type.bool | ||
mustache: Type.bool, | ||
crazy: Type.bool | ||
} | ||
render() { | ||
const { type, height, width, color, mustache, ...rest } = this.props; | ||
const generated = generateURL({ type, height, width, color, mustache }); | ||
const generated = generateURL( this.props ); | ||
return ( | ||
<img | ||
{ ...this.props } | ||
alt={ generated.type } | ||
@@ -23,3 +24,2 @@ src={ generated.url } | ||
height={ generated.height } | ||
{ ...rest } | ||
/> | ||
@@ -26,0 +26,0 @@ ); |
@@ -10,2 +10,13 @@ const SERVICES = { | ||
return `https://placekitten.com/${ color ? '' : 'g/' }${ width }/${ height }`; | ||
}, | ||
segal({ width, height, color }) { | ||
return `http://www.stevensegallery.com/${ color ? '' : 'g/' }${ width }/${ height }`; | ||
}, | ||
cage({ width, height, color, crazy }) { | ||
const type = crazy | ||
? 'c/' | ||
: !color | ||
? 'g/' : ''; | ||
return `http://www.placecage.com/${ type }${ width }/${ height }`; | ||
} | ||
@@ -27,6 +38,7 @@ }; | ||
mustache = false, | ||
crazy = false, | ||
type = getRandom(TYPES) | ||
} = {}) { | ||
const url = SERVICES[type]({ color, width, height }); | ||
const url = SERVICES[type]({ color, width, height, crazy }); | ||
return { | ||
@@ -33,0 +45,0 @@ type, |
{ | ||
"name": "react-lorem-image", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Placeholder images for your react prototypes", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
# Lorem Image [![Build Status](https://travis-ci.org/chriskjaer/react-lorem-image.svg)](https://travis-ci.org/chriskjaer/react-lorem-image) [![npm version](https://badge.fury.io/js/react-lorem-image.svg)](http://badge.fury.io/js/react-lorem-image) | ||
<img src="http://mustachify.me/?src=http://www.fillmurray.com/300/300" | ||
align='left' width="200" height="200" hspace="30" alt="Fill Murray"/> | ||
align='right' width="200" height="200" hspace="20" alt="Fill Murray"/> | ||
@@ -12,2 +12,4 @@ Placeholder images for your React prototypes. | ||
- https://placekitten.com/ | ||
- http://www.placecage.com/ | ||
- http://www.stevensegallery.com/ | ||
@@ -50,2 +52,4 @@ ...and, to top it all of, you have to option to: http://mustachify.me/ ! | ||
- murray - Fill Murray / Bill Murray | ||
- cage - Place Cage | ||
- segal - Steven Segal | ||
@@ -52,0 +56,0 @@ # Contributions |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12645
182
57