diff --git a/package.json b/package.json
index f097495ea..af1004119 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
},
"dependencies": {
"@babel/cli": "^7.4.4",
+ "lazysizes": "^5.1.0",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
diff --git a/src/components/Atoms/Picture/Picture.js b/src/components/Atoms/Picture/Picture.js
index a05229129..f7a280f5b 100644
--- a/src/components/Atoms/Picture/Picture.js
+++ b/src/components/Atoms/Picture/Picture.js
@@ -18,47 +18,38 @@ const Image = styled.img`
/** Responsive Picture */
-const Picture = ({ images, alt, theme, width, height, objectFit }) => {
- const { breakpoint } = theme;
-
- const isSingle = typeof images === 'object';
-
- if (!isSingle) {
+const Picture = ({ images, image, alt, width, height, objectFit }) => {
+ if (!images) {
return (
-
- );
- }
-
- return (
-
+ );
+ }
+
+ return (
+
);
};
Picture.propTypes = {
- images: PropTypes.oneOfType([
- PropTypes.string,
- PropTypes.shape({ picture: PropTypes.string })
- ]).isRequired,
+ images: PropTypes.string,
+ image: PropTypes.string.isRequired,
alt: PropTypes.string,
objectFit: PropTypes.oneOf([
'none',
@@ -68,13 +59,11 @@ Picture.propTypes = {
'scale-down'
]),
width: PropTypes.string,
- height: PropTypes.string,
- theme: PropTypes.shape({
- breakpoint: PropTypes.func
- }).isRequired
+ height: PropTypes.string
};
Picture.defaultProps = {
+ images: null,
objectFit: 'none',
width: '100%',
height: 'auto',
diff --git a/src/components/Atoms/Picture/Picture.md b/src/components/Atoms/Picture/Picture.md
index 285d1133e..771999cb4 100644
--- a/src/components/Atoms/Picture/Picture.md
+++ b/src/components/Atoms/Picture/Picture.md
@@ -1,19 +1,21 @@
+Picture has depenciy of lazysizes for lazyload
+
Picture
```js
const data = require('../../../styleguide/data/data').default;
-;
+;
```
Custom value.
```js
const data = require('../../../styleguide/data/data').default;
-
+console.log(data.images);
;
+;
```
diff --git a/src/components/Atoms/Picture/Picture.test.js b/src/components/Atoms/Picture/Picture.test.js
index 13ba2f106..347d8945e 100644
--- a/src/components/Atoms/Picture/Picture.test.js
+++ b/src/components/Atoms/Picture/Picture.test.js
@@ -17,22 +17,32 @@ it('renders correctly', () => {
object-fit: none;
}
-
+
`);
});
@@ -55,21 +65,31 @@ it('renders correctly with custom props', () => {
object-fit: cover;
}
-
+
`);
});
diff --git a/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js b/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js
index e0bf11bf7..1363ab234 100644
--- a/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js
+++ b/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js
@@ -126,26 +126,21 @@ it('renders correctly', () => {
-
+
@@ -32,7 +32,7 @@ import Link from '../../Atoms/Link/Link';
{
const tree = renderWithTheme(
@@ -115,26 +115,19 @@ it('renders correctly', () => {
-
+
{
).toJSON();
expect(tree).toMatchInlineSnapshot(`
- .c2 {
- color: #FFFFFF;
- text-transform: inherit;
- }
+ .c2 {
+ color: #FFFFFF;
+ text-transform: inherit;
+ }
- .c0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- position: relative;
- -webkit-flex-direction: column;
- -ms-flex-direction: column;
- flex-direction: column;
- background: #7d2ca9;
- }
+ .c0 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ position: relative;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ background: #7d2ca9;
+ }
- .c1 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-flex-direction: column;
- -ms-flex-direction: column;
- flex-direction: column;
- -webkit-box-pack: center;
- -webkit-justify-content: center;
- -ms-flex-pack: center;
- justify-content: center;
- -webkit-box-flex: 0;
- -webkit-flex-grow: 0;
- -ms-flex-positive: 0;
- flex-grow: 0;
- -webkit-flex-shrink: 0;
- -ms-flex-negative: 0;
- flex-shrink: 0;
- -webkit-flex-basis: 50%;
- -ms-flex-preferred-size: 50%;
- flex-basis: 50%;
- padding: 20px;
- -webkit-flex: 0 0 60%;
- -ms-flex: 0 0 60%;
- flex: 0 0 60%;
- margin: auto;
- padding: 100px 20px;
- }
+ .c1 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ -webkit-box-flex: 0;
+ -webkit-flex-grow: 0;
+ -ms-flex-positive: 0;
+ flex-grow: 0;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-flex-basis: 50%;
+ -ms-flex-preferred-size: 50%;
+ flex-basis: 50%;
+ padding: 20px;
+ -webkit-flex: 0 0 60%;
+ -ms-flex: 0 0 60%;
+ flex: 0 0 60%;
+ margin: auto;
+ padding: 100px 20px;
+ }
- @media (min-width:740px) {
- .c0 {
- -webkit-flex-direction: row;
- -ms-flex-direction: row;
- flex-direction: row;
- }
- }
+ @media (min-width:740px) {
+ .c0 {
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ }
+ }
-
- `);
+
+ `);
});
it('renders fullWidth Single Message correctly', () => {
@@ -259,74 +252,74 @@ it('renders fullWidth Single Message correctly', () => {
).toJSON();
expect(tree).toMatchInlineSnapshot(`
- .c2 {
- color: #FFFFFF;
- text-transform: inherit;
- }
+ .c2 {
+ color: #FFFFFF;
+ text-transform: inherit;
+ }
- .c0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- position: relative;
- -webkit-flex-direction: column;
- -ms-flex-direction: column;
- flex-direction: column;
- background: #7d2ca9;
- }
+ .c0 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ position: relative;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ background: #7d2ca9;
+ }
- .c1 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-flex-direction: column;
- -ms-flex-direction: column;
- flex-direction: column;
- -webkit-box-pack: center;
- -webkit-justify-content: center;
- -ms-flex-pack: center;
- justify-content: center;
- -webkit-box-flex: 0;
- -webkit-flex-grow: 0;
- -ms-flex-positive: 0;
- flex-grow: 0;
- -webkit-flex-shrink: 0;
- -ms-flex-negative: 0;
- flex-shrink: 0;
- -webkit-flex-basis: 50%;
- -ms-flex-preferred-size: 50%;
- flex-basis: 50%;
- padding: 20px;
- -webkit-flex: 0 0 60%;
- -ms-flex: 0 0 60%;
- flex: 0 0 60%;
- margin: auto;
- padding: 100px 20px;
- }
+ .c1 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ -webkit-box-flex: 0;
+ -webkit-flex-grow: 0;
+ -ms-flex-positive: 0;
+ flex-grow: 0;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-flex-basis: 50%;
+ -ms-flex-preferred-size: 50%;
+ flex-basis: 50%;
+ padding: 20px;
+ -webkit-flex: 0 0 60%;
+ -ms-flex: 0 0 60%;
+ flex: 0 0 60%;
+ margin: auto;
+ padding: 100px 20px;
+ }
- @media (min-width:740px) {
- .c0 {
- -webkit-flex-direction: row;
- -ms-flex-direction: row;
- flex-direction: row;
- }
- }
+ @media (min-width:740px) {
+ .c0 {
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ }
+ }
-
- `);
+
+ `);
});
diff --git a/src/styleguide/ThemeWrapper.js b/src/styleguide/ThemeWrapper.js
index 826756346..873db8972 100644
--- a/src/styleguide/ThemeWrapper.js
+++ b/src/styleguide/ThemeWrapper.js
@@ -2,6 +2,8 @@ import React from 'react';
import { ThemeProvider } from 'styled-components';
import { crTheme } from '../index';
+import 'lazysizes';
+
import '../theme/shared/fonts.css';
// eslint-disable-next-line react/prop-types
diff --git a/src/styleguide/data/data.js b/src/styleguide/data/data.js
index 244fef491..36936f7ba 100644
--- a/src/styleguide/data/data.js
+++ b/src/styleguide/data/data.js
@@ -7,5 +7,9 @@ export default {
medium: 'picture-2.jpg',
large: 'picture-3.jpg'
},
- ctaText: 'Find out how'
+ ctaText: 'Find out how',
+ image:
+ '//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w',
+ images:
+ '//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=200&h=150&q=50 200w,\n//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=400&h=300&q=50 400w,\n//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w,\n//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1200&h=900&q=50 1200w,\n//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1440&h=1080&q=50 1440w'
};
diff --git a/yarn.lock b/yarn.lock
index 404d6ca4d..584a7e5f4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7740,6 +7740,11 @@ lazy-property@~1.0.0:
resolved "https://registry.yarnpkg.com/lazy-property/-/lazy-property-1.0.0.tgz#84ddc4b370679ba8bd4cdcfa4c06b43d57111147"
integrity sha1-hN3Es3Bnm6i9TNz6TAa0PVcREUc=
+lazysizes@^5.1.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/lazysizes/-/lazysizes-5.1.0.tgz#a87d413aa3765dee03fcb2159f423ab84ed2f2e6"
+ integrity sha512-5NsKePWiWTTCXf3xKFaLOXE6eEX0Y1iWpxYAHnPRiv4JrDpUmgRnuDxeDeskw4hue9SgViXbAtEEvP9Jd8yZfQ==
+
lcid@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"