gatsby-core-theme 2.0.12 → 2.0.16

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,47 @@
1
+ ## [2.0.16](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.15...v2.0.16) (2022-01-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update-placeholder-generation-with-title ([92e3cf2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/92e3cf2663345ddaffb040504f4830d445d2f73c))
7
+
8
+
9
+ * Merge branch 'hotfix-update-placeholder-generation-with-title' into 'master' ([44d05d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/44d05d648d49bdb2d5776d7133e3b569ac1f6353))
10
+
11
+ ## [2.0.15](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.14...v2.0.15) (2022-01-05)
12
+
13
+
14
+ ### Code Refactoring
15
+
16
+ * update gatsby-node.esm page config before create pages ([1363dd6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1363dd6897771e29e3efea3d5afe59399791ff77))
17
+ * update lazy picture, collapse component ([259fffb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/259fffbc988d2caf811a594fe72e53f89d3ad2d2))
18
+ * update meta viewport for accessibility score ([6b59e12](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6b59e12068194701c683ef555f5ba401eee1f3bf))
19
+ * update slider main class ([fb95afc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fb95afc7cfc1520d08fdad90dc38d4487fd2177a))
20
+
21
+
22
+ * Merge branch 'hotfix-update-page-obj-before-create' into 'master' ([a2526c6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a2526c6926702a7ae2e392052d3b5fb965c1a560))
23
+ * Merge branch 'tm-2567-update-theme-for-w3-validator' into 'master' ([42583d8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/42583d876f364761e8eaf5a480989998ea700cb5))
24
+
25
+ ## [2.0.14](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.13...v2.0.14) (2022-01-05)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * lazy image no script tag ([3b47ad0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3b47ad093423a1ef58cd0b9dfedee22f83367552))
31
+
32
+
33
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([a60dbce](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a60dbce4848d3446f115001b5fea0c4269c1a233))
34
+
35
+ ## [2.0.13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.12...v2.0.13) (2022-01-05)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * author box logo fix ([5b74a2b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5b74a2bac4f8dd9efbcc0d29b2b79d640fa26978))
41
+
42
+
43
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([5c6735b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5c6735b01212e5e414afebacfdf70d359d34ca84))
44
+
1
45
  ## [2.0.12](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.11...v2.0.12) (2022-01-04)
2
46
 
3
47
 
@@ -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.12",
3
+ "version": "2.0.16",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -19,6 +19,7 @@
19
19
  margin: 3rem 0 0.5rem 0;
20
20
  font-weight: bold;
21
21
  font-size: var(--h3-mobile-size);
22
+ color: var(--heading-base-color);
22
23
  }
23
24
  .title {
24
25
  margin-bottom: 2rem;
@@ -19,12 +19,15 @@ export default function AuthorBox({ author }) {
19
19
  <div className={styles.container}>
20
20
  <div className={styles.innerContainer}>
21
21
  <div className={styles.information}>
22
- <LazyImage
23
- src={author.image_object?.url}
24
- alt={author.image_alt}
25
- width={author.image_object?.width}
26
- height={author.image_object?.height}
27
- />
22
+ <div>
23
+ {' '}
24
+ <LazyImage
25
+ src={author.image_object?.url}
26
+ alt={author.image_alt}
27
+ width={author.image_object?.width}
28
+ height={author.image_object?.height}
29
+ />
30
+ </div>
28
31
  <span className={styles.name}>{author.name}</span>
29
32
  <p className={styles.title}>{author.author_title}</p>
30
33
  </div>
@@ -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
@@ -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
  });
@@ -23,21 +23,33 @@ export default function LazyImage({
23
23
  if (!isNativeImageLazyLoadingSupported()) {
24
24
  const LazyLoad = loadable(() => import(`react-lazyload`));
25
25
  return (
26
- <LazyLoad
27
- height={height ? `${height}px` : null}
28
- width={width ? `${width}px` : null}
29
- placeholder={<span className="lazyload-placeholder" />}
30
- debounce={0}
31
- >
32
- <img
33
- src={src}
34
- className={className}
35
- height={height}
36
- width={width}
37
- alt={alt}
38
- style={style}
39
- />
40
- </LazyLoad>
26
+ <>
27
+ <LazyLoad
28
+ height={height ? `${height}px` : null}
29
+ width={width ? `${width}px` : null}
30
+ placeholder={<span className="lazyload-placeholder" />}
31
+ debounce={0}
32
+ >
33
+ <img
34
+ src={src}
35
+ className={className}
36
+ height={height}
37
+ width={width}
38
+ alt={alt}
39
+ style={style}
40
+ />
41
+ </LazyLoad>
42
+ <noscript>
43
+ <img
44
+ src={src}
45
+ className={className}
46
+ height={height}
47
+ width={width}
48
+ alt={alt}
49
+ style={style}
50
+ />
51
+ </noscript>
52
+ </>
41
53
  );
42
54
  }
43
55
 
@@ -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 && (