gatsby-core-theme 6.1.1 → 6.1.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,25 @@
1
+ ## [6.1.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.1...v6.1.2) (2022-04-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add star ratings changes ([a7145f4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a7145f4ee6c6e8c73c879e3ea968ef1b5b3566f9))
7
+ * replace h3 with p for heading sequence ([046fd25](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/046fd25173b6293285687c0da4545eb687cfe726))
8
+
9
+
10
+ ### Code Refactoring
11
+
12
+ * seperate one star component ([77e38fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/77e38fc9dfb1ec1b8be2a62bfbbad695ba9c46ca))
13
+
14
+
15
+ * Merge branch 'tm-2813-heading-sequence' into 'master' ([1536f72](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1536f723f30ec5b794222db41fffcd398b3e0688))
16
+ * Merge branch 'fix-star-ratings' into 'master' ([954ff3a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/954ff3ace386c2165421731ad280e6d8ecd60c94))
17
+
18
+
19
+ ### Tests
20
+
21
+ * added test for onestar ([0f21ec6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0f21ec6ae1ae0133450ba1d15c442469c4abf18d))
22
+
1
23
  ## [6.1.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.0...v6.1.1) (2022-04-06)
2
24
 
3
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -52,8 +52,8 @@ export default function OperatorBanner({
52
52
  <LazyImage alt={operator?.name} src={imagePrettyUrl(logo)} />
53
53
  </a>
54
54
  ) : (
55
- <div>
56
- <h3>
55
+ <div className={styles.nameTitle}>
56
+ <p>
57
57
  <a
58
58
  href={prettyLink}
59
59
  title={operator?.name}
@@ -63,7 +63,7 @@ export default function OperatorBanner({
63
63
  >
64
64
  {operator?.name}
65
65
  </a>
66
- </h3>
66
+ </p>
67
67
  {!isPlaceholder && hasStars && (
68
68
  <StarRating numOfStars={5} rating={operator.rating} />
69
69
  )}
@@ -33,7 +33,7 @@
33
33
  }
34
34
 
35
35
  > div:first-child {
36
- h3 a {
36
+ .nameTitle a {
37
37
  @include link-color(var(--color-18));
38
38
  }
39
39
 
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { getRating } from '~helpers/rating';
4
+
5
+ import styles from './one-star.module.scss';
6
+
7
+ const OneStar = ({ numOfStars, rating, active = true }) => (
8
+ <div className={`${styles.starRatingContainer} ${!active && styles.inactive}`}>
9
+ <span className={styles.fullStar} />
10
+ <span className={styles.rateNr}>{`${getRating(rating)}/${numOfStars}`}</span>
11
+ </div>
12
+ );
13
+
14
+ OneStar.propTypes = {
15
+ numOfStars: PropTypes.oneOf([5, 10]).isRequired,
16
+ rating: PropTypes.oneOfType([PropTypes.array, PropTypes.number, PropTypes.string]).isRequired,
17
+ active: PropTypes.bool,
18
+ };
19
+
20
+ export default OneStar;
@@ -0,0 +1,26 @@
1
+ .starRatingContainer {
2
+ @include flex-direction(row);
3
+ @include flex-align(center, center);
4
+ background-color: #ffffff;
5
+ min-width: 6.5rem;
6
+ min-height: 2.1rem;
7
+ border-radius: 0.4rem;
8
+ border: 1px solid var(--main-star-wrapper-color);
9
+
10
+ .fullStar {
11
+ @include star(var(--full-star-fill-color), var(--full-star-border-color));
12
+ }
13
+
14
+ .rateNr {
15
+ color: #17182f;
16
+ font-weight: 700;
17
+ font-size: 1.3rem;
18
+ margin-left: 0.33rem;
19
+ }
20
+
21
+ &.inactive {
22
+ .fullStar {
23
+ @include star(var(--empty-star-border-color), var(--empty-star-border-color));
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+
5
+ import OneStar from './one-star';
6
+
7
+ describe('OneStar Component', () => {
8
+ test('render container with correct rating', async () => {
9
+ const { container } = render(<OneStar numOfStars={5} rating={3} />);
10
+
11
+ expect(container.querySelectorAll('span')).toHaveLength(2);
12
+ expect(container.querySelectorAll('span')[1].innerHTML).toBe('3/5');
13
+ });
14
+ });
15
+
16
+ afterEach(() => {
17
+ cleanup();
18
+ });
@@ -29,4 +29,4 @@
29
29
  @include half-star(var(--empty-star-border-color), var(--empty-star-border-color), var(--halfEmpty-star-fill-color))
30
30
  }
31
31
  }
32
- }
32
+ }
@@ -16,6 +16,7 @@
16
16
  --half-star-border-color: #fba62f;
17
17
  --empty-star-fill-color: white;
18
18
  --empty-star-border-color: grey;
19
+ --main-star-wrapper-color: #a5bcf0;
19
20
 
20
21
  // Font
21
22
  --main-font: Nunito;