gatsby-matrix-theme 6.0.6 → 6.0.7

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,39 @@
1
+ ## [6.0.7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v6.0.6...v6.0.7) (2022-04-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * a typo in the string test file ([b8d5cc8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b8d5cc846eb47e8e6d86f1d8452487d257f38b70))
7
+ * add test to the getRoundMinutes component ([0644d6b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/0644d6be076a6436f58e5caea5595615569cc543))
8
+ * added launch date in toplist ([5320a13](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5320a132deedeeee500bd22c665de518c9e1778c))
9
+ * moved the getRoundMinutes function to strings helpers ([8deae92](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8deae92112931733161e6b9f666b68a75129fd73))
10
+ * removed getRoundMinutes from matrix theme ([02629bd](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/02629bd88cb22d4131963a05ac0c1a06c4cd9344))
11
+ * removed getRoundMinutes tests ([82774ff](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/82774ffd74000cff214ba634deaf8f273354682d))
12
+ * removed helper class ([c3f78f2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c3f78f23e246c339fb9f19446be4e158f72f3be2))
13
+ * removed unecessary code ([01ec93e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/01ec93e1c1976d3a72f497d4469d18d5334270f0))
14
+ * removing the review links for the first operator in Comparison Table ([8c577c5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8c577c5dda35e7ca27d083b2a43fef39f11a4213))
15
+ * solve conflicts ([56978ea](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/56978ea195cfe99ee3df64d4b127ec11605a1887))
16
+ * time to read in OG is rounded to the closest minute ([813930d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/813930d70cfb4914d45825d4e73953e12b1a1c93))
17
+ * update package.json with the new core version ([35d986f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/35d986f270e5c5867b3afc696b70e2d7a021bbab))
18
+ * update project with the latest changes with git pull ([c57e491](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c57e491755eb41dd485b063c7af65a6cac2bc226))
19
+
20
+
21
+ ### Config
22
+
23
+ * add yarn.lock ([e3f236b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e3f236bc787703ba17bccaf6bd155a7b0f87dd08))
24
+ * update version of gatsby core ([4778af2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4778af2f291a6f2983b133a530114c6420a7d934))
25
+
26
+
27
+ * Merge branch 'tm-2832-fix-time-to-read-in-OG' into 'master' ([4848cf2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4848cf2d4ecbf02db60d243e20075f323736acc3))
28
+ * Merge branch 'tm-2814-launch-date' into 'master' ([a18a26a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a18a26a432140468c8b53367b1d3026007f31bb9))
29
+ * Merge branch 'tm-2832-fix-time-to-read-in-OG' into 'master' ([1cb7db4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1cb7db4f851935cb55c692e2772c5a76aa7ff007))
30
+ * Merge branch 'tm-2823-removing-the-review-links' into 'master' ([8e706e3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8e706e3ddc0856be2ace23e63b13f858c5381e24))
31
+
32
+
33
+ ### Tests
34
+
35
+ * add tests to string helper file ([bfa7e57](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/bfa7e5718c0376c6665d01caca4497b1ab2c0726))
36
+
1
37
  ## [6.0.6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v6.0.5...v6.0.6) (2022-04-22)
2
38
 
3
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "6.0.6",
3
+ "version": "6.0.7",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -29,7 +29,7 @@
29
29
  "react": "^17.0.2",
30
30
  "gatsby-plugin-sitemap": "^3.3.0",
31
31
  "react-dom": "^17.0.2",
32
- "gatsby-core-theme": "^6.1.7"
32
+ "gatsby-core-theme": "^6.1.9"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@babel/core": "^7.13.1",
@@ -1,10 +1,11 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
1
2
  import React, { useEffect, useRef } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
 
4
5
  import styles from './comparison-table.module.scss';
5
6
  import Table from './table';
6
7
 
7
- export default function ComparisonTable({ module }) {
8
+ export default function ComparisonTable({ module, page }) {
8
9
  const ele = useRef('');
9
10
 
10
11
  let pos = { top: 0, left: 0, x: 0, y: 0 };
@@ -44,7 +45,7 @@ export default function ComparisonTable({ module }) {
44
45
  return (
45
46
  <div className={styles.comparisonTable}>
46
47
  <div ref={ele} className={styles.contentTable}>
47
- <Table items={module?.items} />
48
+ <Table type={page?.type} items={module?.items} />
48
49
  </div>
49
50
  </div>
50
51
  );
@@ -54,4 +55,7 @@ ComparisonTable.propTypes = {
54
55
  module: PropTypes.shape({
55
56
  items: PropTypes.shape({}),
56
57
  }),
58
+ page: PropTypes.shape({
59
+ type: PropTypes.string,
60
+ }),
57
61
  };
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react/forbid-prop-types */
2
+ /* eslint-disable import/no-extraneous-dependencies */
1
3
  /* eslint-disable jsx-a11y/click-events-have-key-events */
2
4
  /* eslint-disable jsx-a11y/no-static-element-interactions */
3
5
  /* eslint-disable jsx-a11y/anchor-is-valid */
@@ -56,7 +58,12 @@ const listHeadings = [
56
58
  key: 'licenses',
57
59
  },
58
60
  ];
59
- export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKey = 'play_now' }) {
61
+ export default function ComparisonTable({
62
+ items,
63
+ tabelInfo = listHeadings,
64
+ ctaKey = 'play_now',
65
+ type,
66
+ }) {
60
67
  const { translations } = useContext(Context) || {};
61
68
  const [showAllPayment, setShowAllPayment] = useState([]);
62
69
 
@@ -97,7 +104,9 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
97
104
  return (
98
105
  <td key={key} className={styles.raiting}>
99
106
  <StarRating numOfStars={5} rating={item?.relation?.rating} />
100
- <Link to={item.path}> {translate(translations, 'review', 'Review')} </Link>
107
+ {type === 'operator' && index === 0 ? null : (
108
+ <Link to={item.path}> {translate(translations, 'review', 'Review')} </Link>
109
+ )}
101
110
  </td>
102
111
  );
103
112
  case 'bonus':
@@ -17,6 +17,7 @@ import OperatorCta from 'gatsby-core-theme/src/components/atoms/operator-cta';
17
17
  import Tnc from 'gatsby-core-theme/src/components/molecules/tnc';
18
18
  import Bonus from 'gatsby-core-theme/src/components/atoms/bonus';
19
19
  import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
20
+ import { getLaunchDate } from '../../../../helpers/strings';
20
21
  import styles from './variant-one.module.scss';
21
22
 
22
23
  export default function Row({
@@ -43,6 +44,7 @@ export default function Row({
43
44
  }
44
45
  const trackerType = tracker.toLowerCase().replace(' ', '_');
45
46
  const prettyLink = prettyTracker(item, trackerType);
47
+ const launchDate = getLaunchDate(item.founded);
46
48
 
47
49
  return (
48
50
  <div className={`${styles.row} ${layout === 'grid' ? styles.grid : ''}`}>
@@ -111,6 +113,14 @@ export default function Row({
111
113
  <div className={styles.pros}>
112
114
  <SellingPoints icon={<MdCheck />} sellingPoints={sellingPoints} limit={3} />
113
115
  </div>
116
+ <div className={styles.launchDate}>
117
+ {launchDate && (
118
+ <>
119
+ <p>{translate(translations, 'launch_date', 'Launch Date')}</p>
120
+ <p>{launchDate}</p>
121
+ </>
122
+ )}
123
+ </div>
114
124
  <div className={styles.cta}>
115
125
  <OperatorCta operator={item} tracker={tracker} gtmClass="toplist-operator-cta-gtm" />
116
126
  {!isPPC && (
@@ -134,6 +144,7 @@ Row.propTypes = {
134
144
  layout: PropTypes.oneOf(['list', 'grid']),
135
145
  item: PropTypes.shape({
136
146
  path: PropTypes.string,
147
+ founded: PropTypes.string,
137
148
  name: PropTypes.string,
138
149
  logo_url: PropTypes.string,
139
150
  rating: PropTypes.string,
@@ -7,14 +7,14 @@
7
7
 
8
8
  @include min(tablet) {
9
9
  display: grid;
10
- grid-template-columns: 1fr 1fr 1fr;
11
- column-gap: 3rem;
10
+ grid-template-columns: 1fr 1fr 1fr 1fr;
11
+ column-gap: 1rem;
12
12
  padding: 0 0 0 2.4rem;
13
13
  text-align: inherit;
14
14
  }
15
15
 
16
16
  @include min(laptop) {
17
- grid-template-columns: 1fr 1.5fr 1.5fr 1fr;
17
+ grid-template-columns: 1fr 1.5fr 1.5fr 1fr 1fr;
18
18
  padding: 1rem 0 0 2rem;
19
19
  }
20
20
 
@@ -107,7 +107,7 @@
107
107
  @include flex-direction(column);
108
108
 
109
109
  @include min(tablet) {
110
- grid-column: 1/5;
110
+ grid-column: 1/6;
111
111
  order: -1;
112
112
  flex-direction: row;
113
113
  justify-content: center;
@@ -181,9 +181,15 @@
181
181
  }
182
182
  }
183
183
 
184
- .pros {
184
+ .pros, .launchDate {
185
185
  @include flex-align(center, flex-start);
186
- margin: 0 1.5rem 1.5rem;
186
+ margin: 1.5rem 0;
187
+ }
188
+
189
+ .launchDate {
190
+ flex-direction: column;
191
+ font-size: 1.4rem;
192
+ font-weight: 700;
187
193
  }
188
194
 
189
195
  .cta {
@@ -206,7 +212,7 @@
206
212
  }
207
213
 
208
214
  .tandc {
209
- grid-column: 1/5;
215
+ grid-column: 1/6;
210
216
  border-radius: 0 0 var(--border-radius) 0;
211
217
  color: var(--color-34);
212
218
  font-size: 0.8rem;
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
2
  /* eslint-disable arrow-body-style */
3
3
  import React, { useContext } from 'react';
4
+ // eslint-disable-next-line import/no-extraneous-dependencies
4
5
  import PropTypes from 'prop-types';
5
6
  import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
7
  import { imagePrettyUrl, translate } from 'gatsby-core-theme/src/helpers/getters';
@@ -29,12 +30,6 @@ const Author = ({
29
30
  ? translate(translations, 'reviewed_by', 'Review by')
30
31
  : translate(translations, 'written_by', 'Written by');
31
32
 
32
- const getRoundMinutes = (time) => {
33
- const [minutes, seconds] = time.split(':');
34
- const value = seconds > 30 ? Number(minutes) + 1 : Number(minutes);
35
- return value === 0 ? 1 : value;
36
- };
37
-
38
33
  return (
39
34
  <div className={`${styles.authorWraper} ${isCardsAuthor && styles.authorCard} `}>
40
35
  <div className={`${styles.infoContainer} ${isCardsAuthor && styles.infoCardContainer}`}>
@@ -59,9 +54,11 @@ const Author = ({
59
54
  {date && <div>{formatDate(date, dateFormat, splitDateFormat, 'en-GB')}</div>}
60
55
  {readingTime && (
61
56
  <div className={date && styles.readingWithBorder}>
62
- {`${translate(translations, 'reading_time', 'Reading time')} ${getRoundMinutes(
63
- readingTime
64
- )} ${translate(translations, 'minutes', 'min')}`}
57
+ {`${translate(translations, 'reading_time', 'Reading time')} ${readingTime} ${translate(
58
+ translations,
59
+ 'minutes',
60
+ 'min'
61
+ )}`}
65
62
  </div>
66
63
  )}
67
64
  </div>
@@ -43,3 +43,14 @@ export function getTwitterUsername(url) {
43
43
 
44
44
  return null;
45
45
  }
46
+
47
+ export const getLaunchDate = (foundedDate) => {
48
+ if (foundedDate) {
49
+ const arr = foundedDate.split('-');
50
+ if (arr.length === 3) {
51
+ return `${arr[1]}/${arr[0]}`;
52
+ }
53
+ }
54
+
55
+ return null;
56
+ };
@@ -0,0 +1,37 @@
1
+ import {
2
+ capitalize,
3
+ anchorLink,
4
+ leftTrim,
5
+ truncateString,
6
+ getTwitterUsername,
7
+ getLaunchDate,
8
+ } from './strings';
9
+
10
+ describe('String helper component', () => {
11
+ test('A letter to be uppercase', () => {
12
+ expect(capitalize('capitalize')).toBe('Capitalize');
13
+ });
14
+
15
+ test("The whitespace from the link should be replaced with '-'", () => {
16
+ expect(anchorLink('anchor tag')).toBe('anchor-tag');
17
+ });
18
+ test('If space on the left, trim the left, else trim multiple space in between', () => {
19
+ expect(leftTrim(' trim left')).toBe('trim left');
20
+ expect(leftTrim('trim multiple spaces')).toBe('trim multiple spaces');
21
+ });
22
+ test('Truncate the string based on the given number', () => {
23
+ expect(truncateString('gzim', 2)).toBe('gz...');
24
+ });
25
+ test('If it is a space between the string cut it and truncate', () => {
26
+ expect(truncateString('cut the string', 6)).toBe('cut...');
27
+ });
28
+ test('If the string is smaller than the number just return the string', () => {
29
+ expect(truncateString('cut', 6)).toBe('cut');
30
+ });
31
+ test('Twitter helper', () => {
32
+ expect(getTwitterUsername('https://twitter.com/LebronJames')).toBe('LebronJames');
33
+ });
34
+ test('Launch Date', () => {
35
+ expect(getLaunchDate('2022-03-05')).toBe('03/2022');
36
+ });
37
+ });