gatsby-core-theme 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [2.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.1...v2.0.2) (2021-12-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added lazyload for starrating ([34a3bce](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/34a3bce70bde1e9364f4c5aba14845d19d39664e))
|
|
7
|
+
* content iframe lazy ([413f83d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/413f83d70eb05aa514f003e450afce04366537d5))
|
|
8
|
+
* tests ([c56a1c0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c56a1c0168247d25f8445f6b9ed8102c6bae8c08))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([4c1f4f3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4c1f4f3c5f366cd57245ca2ef9bb5ec603d13e97))
|
|
12
|
+
|
|
1
13
|
## [2.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.0...v2.0.1) (2021-12-16)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -4,13 +4,18 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import parse from 'html-react-parser';
|
|
6
6
|
|
|
7
|
+
import loadable from '@loadable/component';
|
|
7
8
|
import LazyImage from '~hooks/lazy-image';
|
|
8
9
|
import { parseCss } from '~helpers/css-parser';
|
|
9
|
-
|
|
10
10
|
import styles from './content.module.scss';
|
|
11
11
|
|
|
12
12
|
const Content = ({ module, pageContext = null }) => {
|
|
13
13
|
const replaceMedia = (node) => {
|
|
14
|
+
if (node.name === 'iframe') {
|
|
15
|
+
const Iframe = loadable(() => import('gatsby-core-theme/src/components/atoms/iframe'));
|
|
16
|
+
return <Iframe src={node.attribs.src} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
if (node.name === 'img') {
|
|
15
20
|
let stylesClass = null;
|
|
16
21
|
const classes = node.attribs.class;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
3
|
+
import LazyLoad from 'react-lazyload';
|
|
4
4
|
import styles from './star-rating.module.scss';
|
|
5
5
|
import keygen from '~helpers/keygen';
|
|
6
6
|
import { getRating } from '~helpers/rating';
|
|
@@ -33,7 +33,11 @@ const StarRating = ({ numOfStars, rating, halfStars = true }) => {
|
|
|
33
33
|
}
|
|
34
34
|
return output;
|
|
35
35
|
};
|
|
36
|
-
return
|
|
36
|
+
return (
|
|
37
|
+
<div className={styles.starRatingContainer}>
|
|
38
|
+
<LazyLoad>{renderFarm()}</LazyLoad>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
StarRating.propTypes = {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, cleanup } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup, waitFor } from '@testing-library/react';
|
|
3
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
4
4
|
|
|
5
5
|
import StarRating from '.';
|
|
6
6
|
|
|
7
7
|
describe('StarRating Component', () => {
|
|
8
|
-
test('render container with lazyload', () => {
|
|
8
|
+
test('render container with lazyload', async () => {
|
|
9
9
|
const { container } = render(<StarRating numOfStars={10} rating={6.5} />);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
expect(container.querySelectorAll('.emptyStar')).toHaveLength(3);
|
|
10
|
+
await waitFor(() => {
|
|
11
|
+
expect(container.querySelectorAll('.lazyload-placeholder')).toHaveLength(1);
|
|
12
|
+
});
|
|
14
13
|
});
|
|
15
14
|
});
|
|
16
15
|
afterEach(() => {
|