react-cloudimage-responsive
Advanced tools
Comparing version 1.6.5 to 1.6.6
@@ -157,2 +157,8 @@ 'use strict'; | ||
var isServer = typeof window === 'undefined'; | ||
if (isServer) { | ||
return _react2.default.createElement('img', { src: this.props.config.baseUrl + this.props.src }); | ||
} | ||
var _state = this.state, | ||
@@ -191,8 +197,2 @@ cloudimageUrl = _state.cloudimageUrl, | ||
var isServer = typeof window === 'undefined'; | ||
if (isServer) { | ||
return _react2.default.createElement('img', { src: config.baseUrl + src }); | ||
} | ||
if (!isProcessed) return _react2.default.createElement('picture', null); | ||
@@ -199,0 +199,0 @@ |
@@ -24,3 +24,3 @@ 'use strict'; | ||
var CloudimageContext = exports.CloudimageContext = _react2.default.createContext(); | ||
var CloudimageContext = exports.CloudimageContext = _react2.default.createContext({ config: {} }); | ||
@@ -30,4 +30,5 @@ var CloudimageProvider = function (_Component) { | ||
function CloudimageProvider(_ref) { | ||
var _ref$config = _ref.config, | ||
function CloudimageProvider() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$config = _ref.config, | ||
config = _ref$config === undefined ? {} : _ref$config; | ||
@@ -34,0 +35,0 @@ |
{ | ||
"name": "react-cloudimage-responsive", | ||
"version": "1.6.5", | ||
"version": "1.6.6", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "Cloudimage Responsive will smartly resize, compress and accelerate images across the World in your site for all devices. The plugin supports lazy loading technique with fancy animation on image load.", |
@@ -1,2 +0,2 @@ | ||
[](https://github.com/scaleflex/react-cloudimage-responsive/releases) | ||
[](https://github.com/scaleflex/react-cloudimage-responsive/releases) | ||
[](https://www.cloudimage.io/en/home#b38181a6-b9c8-4015-9742-7b1a1ad382d5) | ||
@@ -127,3 +127,3 @@ [](#contributing) | ||
Finally, just use the Img component: | ||
### Img component: | ||
@@ -139,2 +139,12 @@ ```html | ||
### BackgroundImg component: | ||
```html | ||
<BackgroundImg src="img.jpg"> | ||
{'Your conent...'} | ||
</BackgroundImg> | ||
``` | ||
<a href="https://codesandbox.io/s/react-cloudimage-responsive-background-1nin8"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edeit in codesandbox"/></a> | ||
## <a name="configuration"></a> Config | ||
@@ -141,0 +151,0 @@ |
54375
776
380