gatsby-core-theme 2.0.14 → 2.0.18

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,50 @@
1
+ ## [2.0.18](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.17...v2.0.18) (2022-01-10)
2
+
3
+
4
+ ### Config
5
+
6
+ * reverted gatsby upgrade ([4155578](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/415557860165a0e9fa5a327470cea2570d0d57ed))
7
+
8
+ ## [2.0.17](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.16...v2.0.17) (2022-01-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * removing cards extra divs ([7096d88](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7096d88b480a43d4d8bd5245cf403b07f194fae0))
14
+ * updated html parser package ([332b237](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/332b237bc728bfe57766fab1bced598ad18ceeb6))
15
+
16
+
17
+ ### Config
18
+
19
+ * updated gatsby packages ([cdfc9c3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cdfc9c3681db2603061b0fcc1f4ef634ce12e7a1))
20
+
21
+
22
+ * Merge branch 'upgrade' into 'master' ([e38a936](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e38a936bc76221072c5d0e89c66fccd3df3cbad7))
23
+
24
+ ## [2.0.16](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.15...v2.0.16) (2022-01-05)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * update-placeholder-generation-with-title ([92e3cf2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/92e3cf2663345ddaffb040504f4830d445d2f73c))
30
+
31
+
32
+ * Merge branch 'hotfix-update-placeholder-generation-with-title' into 'master' ([44d05d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/44d05d648d49bdb2d5776d7133e3b569ac1f6353))
33
+
34
+ ## [2.0.15](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.14...v2.0.15) (2022-01-05)
35
+
36
+
37
+ ### Code Refactoring
38
+
39
+ * update gatsby-node.esm page config before create pages ([1363dd6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1363dd6897771e29e3efea3d5afe59399791ff77))
40
+ * update lazy picture, collapse component ([259fffb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/259fffbc988d2caf811a594fe72e53f89d3ad2d2))
41
+ * update meta viewport for accessibility score ([6b59e12](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6b59e12068194701c683ef555f5ba401eee1f3bf))
42
+ * update slider main class ([fb95afc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fb95afc7cfc1520d08fdad90dc38d4487fd2177a))
43
+
44
+
45
+ * Merge branch 'hotfix-update-page-obj-before-create' into 'master' ([a2526c6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a2526c6926702a7ae2e392052d3b5fb965c1a560))
46
+ * Merge branch 'tm-2567-update-theme-for-w3-validator' into 'master' ([42583d8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/42583d876f364761e8eaf5a480989998ea700cb5))
47
+
1
48
  ## [2.0.14](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.13...v2.0.14) (2022-01-05)
2
49
 
3
50
 
@@ -5,7 +5,7 @@
5
5
  import { cloneDeep, chunk, pick } from 'lodash';
6
6
  import chalk from 'chalk';
7
7
  import { getData, getLocalData } from './src/helpers/api';
8
- import { generateMetaString, generateTrackerLink } from './src/helpers/generators';
8
+ import { generatePlaceholderString, generateTrackerLink } from './src/helpers/generators';
9
9
  import processor, { processSitemapPages } from './src/helpers/processor';
10
10
  import { pickAuthorsPageKeys } from './src/constants/pick-keys';
11
11
 
@@ -194,37 +194,45 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
194
194
  const processedPage = page;
195
195
  processedPage.preconnect_links = preconnectLinks;
196
196
 
197
- page.translations = {};
198
-
199
- if (hasArchiveModule(page)) {
200
- createArchivePage(page, marketSections, prefilledModules, createPage);
201
- return;
202
- }
203
-
204
- if (page.type === 'event' && !page.relation.event) {
205
- return;
206
- }
207
197
  siteSchema = response.schema[page['market_id']];
208
198
  authors = response.authors;
199
+
200
+ page.translations = {};
209
201
  // siteSchema and authors are added to page for schemaGenerator()
210
202
  page.siteSchema = siteSchema;
211
203
  page.authors = Object.keys(authors || {}).map((key) =>
212
204
  pick(authors[key], pickAuthorsPageKeys)
213
205
  );
214
- // Done for matrix-theme sites for placeholders auto update
206
+
207
+ // replacing string placehoders with year, month, date, etc.
208
+ page.title =
209
+ page.title &&
210
+ generatePlaceholderString(page.title, translations, {
211
+ siteName: response.general.site_name,
212
+ siteTitle: page.title,
213
+ });
215
214
  page.meta_title =
216
215
  page.meta_title &&
217
- generateMetaString(page.meta_title, translations, {
216
+ generatePlaceholderString(page.meta_title, translations, {
218
217
  siteName: response.general.site_name,
219
218
  siteTitle: page.title,
220
219
  });
221
220
  page.meta_description =
222
221
  page.meta_description &&
223
- generateMetaString(page.meta_description, translations, {
222
+ generatePlaceholderString(page.meta_description, translations, {
224
223
  siteName: response.general.site_name,
225
224
  siteTitle: page.title,
226
225
  });
227
226
 
227
+ if (hasArchiveModule(page)) {
228
+ createArchivePage(page, marketSections, prefilledModules, createPage);
229
+ return;
230
+ }
231
+
232
+ if (page.type === 'event' && !page.relation.event) {
233
+ return;
234
+ }
235
+
228
236
  const contextData = {
229
237
  page,
230
238
  marketSections,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "2.0.14",
3
+ "version": "2.0.18",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -45,7 +45,7 @@
45
45
  "gatsby-plugin-webfonts": "^2.1.0",
46
46
  "gatsby-source-filesystem": "^3.3.0",
47
47
  "gatsby-transformer-sharp": "^3.3.0",
48
- "html-react-parser": "^1.2.5",
48
+ "html-react-parser": "^1.3.0",
49
49
  "js-search": "^2.0.0",
50
50
  "lodash": "^4.17.15",
51
51
  "node-sass": "5.0.0",
@@ -38,7 +38,7 @@ const Collapse = ({
38
38
 
39
39
  return (
40
40
  <div className={styles.collapseContainer}>
41
- <div className={`${maxHeightStyle !== 0 ? styles.active : ''}`}>
41
+ <div className={maxHeightStyle !== 0 ? styles.active : null}>
42
42
  {showButton && (
43
43
  <button
44
44
  type="button"
@@ -52,7 +52,7 @@ const Collapse = ({
52
52
  )}
53
53
  <div
54
54
  ref={contentRef}
55
- className={`${showButton ? styles.content : ''}`}
55
+ className={showButton ? styles.content : null}
56
56
  style={showButton ? { maxHeight: maxHeightStyle } : {}}
57
57
  >
58
58
  {contentText}
@@ -31,9 +31,6 @@
31
31
  p {
32
32
  color: var(--color-22);
33
33
  }
34
- .label {
35
- font-size: bold;
36
- }
37
34
  .value {
38
35
  font-weight: 400;
39
36
  }
@@ -198,7 +198,7 @@ function Slider({
198
198
  onKeyDown: () => arrowHandler('next'),
199
199
  disabled: Math.abs(state.slideIndex) === state.length - 1 && true,
200
200
  })}
201
- <div className={`${styles.sliderContent}`} style={style} ref={sliderContentRef}>
201
+ <div className={styles.sliderContent} style={style} ref={sliderContentRef}>
202
202
  {children.map((slide, index) => (
203
203
  <div
204
204
  // eslint-disable-next-line react/no-array-index-key
@@ -12,6 +12,7 @@ const CardsGridStyles = ({
12
12
  mobileColumns = 2,
13
13
  tabletColumns = 3,
14
14
  desktopColumns = 4,
15
+ className = '',
15
16
  }) => {
16
17
  const divStyle = {
17
18
  '--cards-mob-column': `${
@@ -24,10 +25,15 @@ const CardsGridStyles = ({
24
25
  module.desktop_num_of_columns ? module.desktop_num_of_columns : desktopColumns
25
26
  }`,
26
27
  };
27
- return <div style={divStyle}>{children}</div>;
28
+ return (
29
+ <div className={className} style={divStyle}>
30
+ {children}
31
+ </div>
32
+ );
28
33
  };
29
34
 
30
35
  CardsGridStyles.propTypes = {
36
+ className: PropTypes.string,
31
37
  module: PropTypes.shape({
32
38
  mobile_num_of_columns: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
33
39
  tablet_num_of_columns: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -53,25 +59,23 @@ const Cards = ({
53
59
  desktopColumns={desktopColumns}
54
60
  tabletColumns={tabletColumns}
55
61
  mobileColumns={mobileColumns}
62
+ className={styles.cardsContainer}
56
63
  >
57
- <div className={styles.cardsContainer}>
58
- {module.items &&
59
- module.items.map((item, index) => (
60
- <div key={keygen()}>
61
- {CustomCardComponent ? (
62
- <CustomCardComponent
63
- featured={module.style === 'featured'}
64
- item={item}
65
- type={item.type}
66
- number={index + 1}
67
- page={page}
68
- />
69
- ) : (
70
- <Card item={item} />
71
- )}
72
- </div>
73
- ))}
74
- </div>
64
+ {module.items &&
65
+ module.items.map((item, index) =>
66
+ CustomCardComponent ? (
67
+ <CustomCardComponent
68
+ key={keygen()}
69
+ featured={module.style === 'featured'}
70
+ item={item}
71
+ type={item.type}
72
+ number={index + 1}
73
+ page={page}
74
+ />
75
+ ) : (
76
+ <Card key={keygen()} item={item} />
77
+ )
78
+ )}
75
79
  </CardsGridStyles>
76
80
  );
77
81
 
@@ -21,7 +21,7 @@ export function generateTrackerLink(operator, trackerType) {
21
21
  }
22
22
  }
23
23
 
24
- export function generateMetaString(metaString, translations, props) {
24
+ export function generatePlaceholderString(string, translations, props) {
25
25
  const date = new Date();
26
26
  const day = date.getDate();
27
27
  const month = months[date.getMonth()];
@@ -29,7 +29,7 @@ export function generateMetaString(metaString, translations, props) {
29
29
  const regex =
30
30
  /\[MONTH\]|\[YEAR\]|\[currentyear\]|\[sitename\]|\[currentmonth\]|\[title\]|\[currentdate\]/gi;
31
31
 
32
- return metaString.replace(
32
+ return string.replace(
33
33
  regex,
34
34
  (match) =>
35
35
  ({
@@ -1,4 +1,4 @@
1
- import { generateTrackerLink, generateMetaString } from './generators';
1
+ import { generateTrackerLink, generatePlaceholderString } from './generators';
2
2
  import { months } from '~constants/common';
3
3
 
4
4
  describe('Generate Tracker Link Helper', () => {
@@ -16,19 +16,19 @@ describe('Generate Tracker Link Helper', () => {
16
16
  });
17
17
  });
18
18
 
19
- describe('Generate Meta Title Helper', () => {
20
- test('generateMetaString uppercase', () => {
21
- const metaString = generateMetaString('meta title [MONTH] [YEAR]');
19
+ describe('Generate Placeholders String', () => {
20
+ test('generatePlaceholderString uppercase', () => {
21
+ const string = generatePlaceholderString('Some title [MONTH] [YEAR]');
22
22
  const date = new Date();
23
23
 
24
- expect(metaString).not.toContain('[MONTH]');
25
- expect(metaString).not.toContain('[YEAR]');
26
- expect(metaString).toContain(date.getFullYear());
27
- expect(metaString).toContain(months[date.getMonth()]);
24
+ expect(string).not.toContain('[MONTH]');
25
+ expect(string).not.toContain('[YEAR]');
26
+ expect(string).toContain(date.getFullYear());
27
+ expect(string).toContain(months[date.getMonth()]);
28
28
  });
29
- test('generateMetaString lowercase', () => {
30
- const metaString = generateMetaString(
31
- 'meta title [currentdate] [currentmonth] [currentyear] [sitename] [title]',
29
+ test('generatePlaceholderString lowercase', () => {
30
+ const string = generatePlaceholderString(
31
+ 'Some title [currentdate] [currentmonth] [currentyear] [sitename] [title]',
32
32
  null,
33
33
  {
34
34
  siteName: 'Site Name',
@@ -37,26 +37,26 @@ describe('Generate Meta Title Helper', () => {
37
37
  );
38
38
  const date = new Date();
39
39
 
40
- expect(metaString).not.toContain('[currentdate]');
41
- expect(metaString).not.toContain('[currentmonth]');
42
- expect(metaString).not.toContain('[currentyear]');
43
- expect(metaString).not.toContain('[sitename]');
44
- expect(metaString).not.toContain('[title]');
45
- expect(metaString).toContain(date.getDate());
46
- expect(metaString).toContain(months[date.getMonth()]);
47
- expect(metaString).toContain(date.getFullYear());
48
- expect(metaString).toContain('Site Name');
49
- expect(metaString).toContain('Site Title');
40
+ expect(string).not.toContain('[currentdate]');
41
+ expect(string).not.toContain('[currentmonth]');
42
+ expect(string).not.toContain('[currentyear]');
43
+ expect(string).not.toContain('[sitename]');
44
+ expect(string).not.toContain('[title]');
45
+ expect(string).toContain(date.getDate());
46
+ expect(string).toContain(months[date.getMonth()]);
47
+ expect(string).toContain(date.getFullYear());
48
+ expect(string).toContain('Site Name');
49
+ expect(string).toContain('Site Title');
50
50
  });
51
- test('generateMetaString translated', () => {
51
+ test('generatePlaceholderString translated', () => {
52
52
  const translateMonths = months.reduce(
53
53
  (translated, month) => ({ ...translated, [month]: `translate${month.substring(0, 1)}` }),
54
54
  {}
55
55
  );
56
- const metaString = generateMetaString('meta title [MONTH]', translateMonths);
56
+ const string = generatePlaceholderString('Some title [MONTH]', translateMonths);
57
57
  const date = new Date();
58
58
 
59
- expect(metaString).not.toContain('[MONTH]');
60
- expect(metaString).toContain(translateMonths[months[date.getMonth()]]);
59
+ expect(string).not.toContain('[MONTH]');
60
+ expect(string).toContain(translateMonths[months[date.getMonth()]]);
61
61
  });
62
62
  });
@@ -19,7 +19,13 @@ export default function LazyPicture({
19
19
  mobileBreakpoint = '768',
20
20
  }) {
21
21
  return (
22
- <LazyLoad height={`${height}px`} width={`${width}px`} offset={offset} debounce={0}>
22
+ <LazyLoad
23
+ height={height ? `${height}px` : null}
24
+ width={width ? `${width}px` : null}
25
+ placeholder={<span className="lazyload-placeholder" />}
26
+ offset={offset}
27
+ debounce={0}
28
+ >
23
29
  <picture className={className}>
24
30
  {webp && <source srcSet={webp} type="image/webp" />}
25
31
  {mobileSrc && desktopSrc && (