gatsby-matrix-theme 41.0.5 → 42.0.0

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.
Files changed (49) hide show
  1. package/.storybook/preview.js +1 -0
  2. package/CHANGELOG.md +53 -0
  3. package/package.json +2 -2
  4. package/src/components/atoms/author/template-one/index.js +1 -1
  5. package/src/components/atoms/author/template-three/index.js +98 -0
  6. package/src/components/atoms/author/template-three/template-three.module.scss +58 -0
  7. package/src/components/atoms/author/template-three/template-three.stories.js +155 -0
  8. package/src/components/atoms/author/template-three/template-three.test.js +172 -0
  9. package/src/components/atoms/author/template-two/index.js +1 -1
  10. package/src/components/atoms/author/template-two/{author-template.module.scss → template-two.module.scss} +0 -2
  11. package/src/components/atoms/disclaimer/affiliate-disclaimer/affiliate-disclaimer.stories.js +1 -1
  12. package/src/components/atoms/info-grid/grid-item/index.js +14 -11
  13. package/src/components/atoms/review-credits/index.js +56 -85
  14. package/src/components/atoms/review-credits/review-credits.module.scss +43 -59
  15. package/src/components/atoms/review-credits/review-credits.stories.js +9 -9
  16. package/src/components/atoms/review-credits/review-credits.test.js +16 -12
  17. package/src/components/molecules/multiple-contributors/contributor/contributor.module.scss +113 -0
  18. package/src/components/molecules/multiple-contributors/contributor/contributor.stories.js +113 -0
  19. package/src/components/molecules/multiple-contributors/contributor/contributor.test.js +106 -0
  20. package/src/components/molecules/multiple-contributors/contributor/index.js +96 -0
  21. package/src/components/molecules/multiple-contributors/index.js +84 -0
  22. package/src/components/molecules/multiple-contributors/multiple-contributors.module.scss +79 -0
  23. package/src/components/molecules/multiple-contributors/multiple-contributors.stories.js +110 -0
  24. package/src/components/molecules/multiple-contributors/multiple-contributors.test.js +70 -0
  25. package/src/components/molecules/sportstake/lotto-module/winning-numbers/index.js +4 -0
  26. package/src/components/molecules/sportstake/lotto-module/winning-numbers/lotto.module.scss +82 -1
  27. package/src/gatsby-core-theme/components/molecules/main/index.js +55 -37
  28. package/src/gatsby-core-theme/components/molecules/module/index.js +3 -0
  29. package/src/gatsby-core-theme/styles/utils/variables/_main.scss +13 -0
  30. package/src/images/icons/fact-check.js +27 -0
  31. package/storybook/public/{341.3998fe70.iframe.bundle.js → 341.5cd53407.iframe.bundle.js} +4 -4
  32. package/storybook/public/{341.3998fe70.iframe.bundle.js.map → 341.5cd53407.iframe.bundle.js.map} +1 -1
  33. package/storybook/public/472.5c5f9f3f.iframe.bundle.js +1 -0
  34. package/storybook/public/943.a612f303.iframe.bundle.js +1 -0
  35. package/storybook/public/iframe.html +1 -1
  36. package/storybook/public/main.2f307e61.iframe.bundle.js +1 -0
  37. package/storybook/public/project.json +1 -2
  38. package/storybook/public/runtime~main.df0a0633.iframe.bundle.js +1 -0
  39. package/storybook-images/icons/fact-check.js +27 -0
  40. package/tests/factories/authors/author.factory.js +2 -0
  41. package/storybook/public/943.bb1590d6.iframe.bundle.js +0 -1
  42. package/storybook/public/main.e41fe4c6.iframe.bundle.js +0 -1
  43. package/storybook/public/runtime~main.d300756c.iframe.bundle.js +0 -1
  44. /package/src/components/atoms/author/template-one/{author-template.module.scss → template-one.module.scss} +0 -0
  45. /package/src/components/atoms/author/template-one/{author-templateOne.stories.js → template-one.stories.js} +0 -0
  46. /package/src/components/atoms/author/template-one/{author-TemplateOne.test.js → template-one.test.js} +0 -0
  47. /package/src/components/atoms/author/template-two/{author-templateTwo.stories.js → template-two.stories.js} +0 -0
  48. /package/src/components/atoms/author/template-two/{author-TemplateTwo.test.js → template-two.test.js} +0 -0
  49. /package/storybook/public/{341.3998fe70.iframe.bundle.js.LICENSE.txt → 341.5cd53407.iframe.bundle.js.LICENSE.txt} +0 -0
@@ -73,6 +73,7 @@ export const parameters = {
73
73
  ],
74
74
  ],
75
75
  'Atoms',
76
+ ['Affiliate Disclaimer', 'Author', ['Template One', 'Template Two', 'Template Three']],
76
77
  'Molecules',
77
78
  'Organisms',
78
79
  'Pages',
package/CHANGELOG.md CHANGED
@@ -1,3 +1,56 @@
1
+ # [42.0.0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v41.0.5...v42.0.0) (2024-05-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add bonus module on lotto pages ([a0e79fc](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a0e79fccb3054a2ce4da7c57c184f92d47a2f9e0))
7
+ * positioning and styling of banner ([fa32503](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fa3250368acfbf4f1046087ba131bead7cdaa98b))
8
+
9
+
10
+ ### Code Refactoring
11
+
12
+ * add titles per page path ([bdea324](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/bdea324addcec04b629927712e31c229b6cd6aad))
13
+ * changes to author info grid ([7ad6fc3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7ad6fc3337062fe33f5c13a918c12bdff2210f18))
14
+ * changes to author name tag ([5529f3e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5529f3efd40b9f66d77b906b25db7814017ca503))
15
+ * changes to multiple authors on author review credits ([5570a1a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5570a1a102ad4c129c3cb5fb6f81f5f42179b8fa))
16
+ * changes to multiple contributors ([7be9504](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7be95041f7c2fa8f17f91d279b6fdbfa1db50aac))
17
+ * changes to multiple contributors ([cf1c7b4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/cf1c7b441c767abd2a6f7578eb936c1079c8ab21))
18
+ * changes to template 4 ([a02b068](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a02b06868de378e55e2e150fb558c3cba3cc5d8b))
19
+ * changes to template 4 ([af180a7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/af180a73fe790c2b2081bda7e1ca09a28808b40d))
20
+ * changes when author bio is empty ([e2e86de](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e2e86de6ed4fcc4aa896207d2074b380511a143d))
21
+ * correction to title tags ([fb3ba03](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fb3ba0310883a9f6fe3d3a7ae437ad84cb46e1b9))
22
+ * initial commit and name correction to author templates ([3f94ee9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3f94ee94332f5020bccec1efeeaac9aa6f84f5cd))
23
+ * multiple contributors ([51e9743](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/51e9743ace04a41d668f29e4633fd3e92d9e0f28))
24
+ * multiple contributors storybook ([e762254](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e762254be832e0b6a0c64be123ec255570c7238b))
25
+ * remove temp ([7e45eec](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7e45eec25637f269f75671f03025bf8098e9df1a))
26
+ * storybook refactoring and correction to fact checker icon ([a63557f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a63557f08d0b3d396d2ca3ef60ec6db1bcda7bc1))
27
+ * temp ([062fb84](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/062fb84ed52757b6a8ce6f49063c7a0f25db37b4))
28
+
29
+
30
+ ### Config
31
+
32
+ * update theme ([ee2de80](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ee2de801f4510f3ba17614296563f8a7a060e80b))
33
+
34
+
35
+ * Merge branch 'tm-4389-author-info-grid' into 'master' ([fe94330](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fe943302742301de66dfc77ec03acff39b825178))
36
+ * Merge branch 'tm-4269-multiple-contributors' into 'master' ([ea11482](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ea1148223742569d36c1bc5603200afee0d117ac))
37
+ * Merge branch 'tm-40438-spotlights' into 'master' ([ce757f9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ce757f9ff086dffd3c3592d399bcc2588188333e))
38
+ * Merge branch 'tm-4245-bonus-module-lotto-pages' into 'master' ([1080a38](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1080a38aa6775178f44755c9415f54418e32eb79))
39
+ * Merge branch 'master' into tm-4269-multiple-contributors ([7fe00a5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7fe00a5fe16a06c7d6ccfd71a386cc0295271b5a))
40
+ * Merge branch 'master' into tm-40438-spotlights ([4cac87d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4cac87d0597214d6955a2e2703dc82e41242f6de))
41
+ * Merge branch 'master' into tm-4269-multiple-contributors ([40e8374](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/40e8374c9b01f2936373275b35c8e1384e4fd5a5))
42
+ * Merge branch 'master' into tm-4269-multiple-contributors ([ff9db93](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/ff9db938e524d6443dd571aa315c4df7d54bde4d))
43
+ * Merge branch 'master' into tm-4269-multiple-contributors ([fae36b9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fae36b96fde37362521e86b01e0aa2914b5f8d94))
44
+ * Merge branch 'master' into tm-4269-multiple-contributors ([a752666](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a752666220f63fa61708c24fb75d2c1b2fb66eb1))
45
+ * Merge branch 'master' into tm-4269-multiple-contributors ([134dfaa](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/134dfaa9affe8e70067c4deeb22275916692d105))
46
+ * Merge branch 'master' into tm-4269-multiple-contributors ([c55491b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c55491b8cb6ecd02c1d8df5dd5744baad147ba42))
47
+ * Merge branch 'master' into tm-4269-multiple-contributors ([5f83588](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5f83588e36b7922400d7172152c862160c09e199))
48
+
49
+
50
+ ### Tests
51
+
52
+ * test scripts ([bb0c235](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/bb0c2359fffa298728d463bc2c711f5e83b5f0f9))
53
+
1
54
  ## [41.0.5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v41.0.4...v41.0.5) (2024-05-14)
2
55
 
3
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "41.0.5",
3
+ "version": "42.0.0",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@react-icons/all-files": "^4.1.0",
27
27
  "gatsby": "^5.11.0",
28
- "gatsby-core-theme": "30.1.3",
28
+ "gatsby-core-theme": "31.0.0",
29
29
  "gatsby-plugin-sharp": "^5.11.0",
30
30
  "gatsby-plugin-sitemap": "^3.3.0",
31
31
  "gatsby-transformer-sharp": "^5.11.0",
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
4
4
  import Link from 'gatsby-core-theme/src/hooks/link';
5
- import styles from './author-template.module.scss';
5
+ import styles from './template-one.module.scss';
6
6
 
7
7
  const AuthorTemplateOne = ({
8
8
  label = '',
@@ -0,0 +1,98 @@
1
+ import React, { useContext } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { imagePrettyUrl, translate } from 'gatsby-core-theme/src/helpers/getters';
4
+ import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
+ import Link from 'gatsby-core-theme/src/hooks/link';
6
+ import { Context } from '~context/MainProvider';
7
+ import FactCheckIcon from '../../../../images/icons/fact-check';
8
+ import styles from './template-three.module.scss';
9
+
10
+ const AuthorTemplateThree = ({
11
+ authorImage,
12
+ authorImageHeight = 48,
13
+ authorImageWidth = 48,
14
+ authorName,
15
+ authorPath,
16
+ authorTitle,
17
+ customStyles,
18
+ isReviewer = false,
19
+ prefix,
20
+ showLinks = true,
21
+ showPrefix = false,
22
+ showTitle = true,
23
+ showVerification = true,
24
+ type,
25
+ verify = <FactCheckIcon width={15} height={15} />,
26
+ }) => {
27
+ const { translations } = useContext(Context) || {};
28
+
29
+ const getPrefixBasedOnPage = type?.includes('review')
30
+ ? translate(translations, 'reviewed_by', 'Review by')
31
+ : translate(translations, 'written_by', 'Written by');
32
+
33
+ const getAuthorTitle = <span className={styles.authorTitle}>{authorTitle}</span>;
34
+
35
+ return (
36
+ <>
37
+ {showPrefix && (
38
+ <span className={styles.prefix || ''}>
39
+ {isReviewer
40
+ ? translate(translations, 'fact_checked_by', 'Fact checked by')
41
+ : translate(translations, prefix, prefix) || getPrefixBasedOnPage}
42
+ </span>
43
+ )}
44
+ <div className={`${styles.authorContainer || ''} ${customStyles || ''}`}>
45
+ {authorImage && (
46
+ <LazyImage
47
+ alt={authorName}
48
+ loading="eager"
49
+ width={authorImageWidth}
50
+ height={authorImageHeight}
51
+ src={imagePrettyUrl(authorImage, authorImageWidth, authorImageHeight)}
52
+ />
53
+ )}
54
+ <div className={styles.authorDataContainer || ''}>
55
+ {showLinks ? (
56
+ <Link to={authorPath} title={authorName} className={styles.authorName}>
57
+ {authorName}
58
+ </Link>
59
+ ) : (
60
+ <p>{authorName}</p>
61
+ )}
62
+
63
+ {showTitle && !isReviewer && getAuthorTitle}
64
+ {isReviewer &&
65
+ (showTitle ? (
66
+ getAuthorTitle
67
+ ) : (
68
+ // eslint-disable-next-line jsx-a11y/label-has-associated-control
69
+ <label className={styles.reviewerTitle}>
70
+ {showVerification && verify}
71
+ {translate(translations, 'fact_checker', 'Fact-checker')}
72
+ </label>
73
+ ))}
74
+ </div>
75
+ </div>
76
+ </>
77
+ );
78
+ };
79
+
80
+ AuthorTemplateThree.propTypes = {
81
+ authorImage: PropTypes.string,
82
+ authorImageHeight: PropTypes.bool,
83
+ authorImageWidth: PropTypes.bool,
84
+ authorName: PropTypes.string,
85
+ authorPath: PropTypes.string,
86
+ authorTitle: PropTypes.string,
87
+ customStyles: PropTypes.string,
88
+ prefix: PropTypes.string,
89
+ isReviewer: PropTypes.bool,
90
+ showLinks: PropTypes.bool,
91
+ showPrefix: PropTypes.bool,
92
+ showTitle: PropTypes.bool,
93
+ showVerification: PropTypes.bool,
94
+ type: PropTypes.string,
95
+ verify: PropTypes.element,
96
+ };
97
+
98
+ export default AuthorTemplateThree;
@@ -0,0 +1,58 @@
1
+ .authorContainer {
2
+ @include flex-direction(row);
3
+ @include flex-align(center, center);
4
+ display: grid;
5
+ grid-template-columns: 4.8rem 1fr;
6
+ gap: 0.8rem;
7
+
8
+ > img {
9
+ border-radius: var(--author-template-three-image-border-radius, 10rem);
10
+ border: var(--author-template-three-author-image-border, 1px solid #ececec);
11
+ }
12
+ }
13
+
14
+ .authorName {
15
+ font-size: var(--author-template-three-author-name-font-size, 1.6rem);
16
+ font-weight: var(--author-template-three-author-name-font-weight, 700);
17
+ line-height: var(--author-template-three-author-name-line-height, 2.2rem);
18
+ color: var(--author-template-three-author-name-font-color, #1b1b1c);
19
+ }
20
+
21
+ .authorDataContainer {
22
+ @include flex-direction(column);
23
+ @include flex-align(flex-start, space-between);
24
+ gap: 0.4rem;
25
+ }
26
+
27
+ .prefix {
28
+ color: var(--author-template-three-prefix-text-color, #64646d);
29
+ text-decoration: none;
30
+ font-size: var(--author-template-three-reviewer-title-font-size, 1.4rem);
31
+ font-weight: var(--author-template-three-reviewer-title-font-weight, 500);
32
+ line-height: var(--author-template-three-reviewer-title-line-height, 2.2rem);
33
+ }
34
+
35
+ .authorTitle {
36
+ font-size: var(--author-template-three-author-title-font-size, 0.9rem);
37
+ font-weight: var(--author-template-three-author-title-font-weight, 700);
38
+ line-height: var(--author-template-three-author-title-line-height, 1.2rem);
39
+ letter-spacing: var(--author-template-three-author-title-letter-spacing, 0.5px);
40
+ text-align: center;
41
+ padding: 0.4rem 0.8rem;
42
+ gap: 1rem;
43
+ border-radius: var(--author-template-three-author-title-border-radius, 10rem);
44
+ background: var(--author-template-three-author-title-background-color, #6e33e5);
45
+ color: var(--author-template-three-author-title-color, #ffffff);
46
+ text-transform: uppercase;
47
+ }
48
+
49
+ .reviewerTitle {
50
+ @include flex-direction(row);
51
+ @include flex-align(center, center);
52
+ gap: 0.4rem;
53
+ color: var(--author-template-three-revierwer-title-text-color, #64646d);
54
+ text-decoration: none;
55
+ font-size: var(--author-template-three-reviewer-title-font-size, 1.4rem);
56
+ font-weight: var(--author-template-three-reviewer-title-font-weight, 500);
57
+ line-height: var(--author-template-three-reviewer-title-line-height, 2.2rem);
58
+ }
@@ -0,0 +1,155 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import React from 'react';
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ ArgsTable,
8
+ PRIMARY_STORY,
9
+ } from '@storybook/addon-docs/blocks';
10
+ import FactCheckIcon from '../../../../../storybook-images/icons/fact-check';
11
+ import AuthorTemplateOne from '.';
12
+
13
+ export default {
14
+ title: 'Theme/Atoms/Author/Template Three',
15
+ component: AuthorTemplateOne,
16
+ argTypes: {
17
+ authorImageWidth: {
18
+ name: 'authorImageWidth',
19
+ type: { name: 'number', required: false },
20
+ defaultValue: 48,
21
+ description: 'Author/Reviewer image width',
22
+ table: {
23
+ type: { summary: 'number' },
24
+ defaultValue: { summary: 48 },
25
+ },
26
+ },
27
+ authorTitle: {
28
+ name: 'authorTitle',
29
+ type: { name: 'string', required: false },
30
+ defaultValue: 'Casino Export',
31
+ description: 'Author job title',
32
+ },
33
+ authorImageHeight: {
34
+ name: 'authorImageHeight',
35
+ type: { name: 'number', required: false },
36
+ defaultValue: 48,
37
+ description: 'Author/Reviewer image height',
38
+ table: {
39
+ type: { summary: 'number' },
40
+ defaultValue: { summary: 48 },
41
+ },
42
+ },
43
+ authorName: {
44
+ control: 'text',
45
+ defaultValue: 'John Doe',
46
+ },
47
+ authorPath: {
48
+ control: 'text',
49
+ defaultValue: 'https://example.com',
50
+ },
51
+ authorImage: {
52
+ control: 'text',
53
+ defaultValue: '1675685947/ellipse-1.png',
54
+ },
55
+ verify: {
56
+ name: 'verify',
57
+ type: { name: 'element', required: false },
58
+ defaultValue: <FactCheckIcon width={15} height={15} />,
59
+ description: 'Icon for verify badge',
60
+ table: {
61
+ type: { summary: 'element' },
62
+ defaultValue: { summary: <FactCheckIcon width={15} height={15} /> },
63
+ },
64
+ },
65
+ showVerification: {
66
+ name: 'showVerification',
67
+ type: { name: 'boolean', required: false },
68
+ defaultValue: true,
69
+ description: 'Show/Hide verification badge for reviewer only',
70
+ table: {
71
+ type: { summary: 'boolean' },
72
+ defaultValue: { summary: true },
73
+ },
74
+ },
75
+ isReviewer: {
76
+ name: 'isReviewer',
77
+ type: { name: 'boolean', required: false },
78
+ defaultValue: false,
79
+ description: 'Indicate if its a Reviewer',
80
+ table: {
81
+ type: { summary: 'boolean' },
82
+ defaultValue: { summary: false },
83
+ },
84
+ },
85
+ prefix: {
86
+ name: 'prefix',
87
+ type: { name: 'string', required: false },
88
+ defaultValue: '',
89
+ description: 'Author Prefix',
90
+ table: {
91
+ type: { summary: 'string' },
92
+ defaultValue: { summary: '' },
93
+ },
94
+ },
95
+ showLinks: {
96
+ name: 'showLinks',
97
+ type: { name: 'boolean', required: false },
98
+ defaultValue: true,
99
+ description: 'Show/Hide links',
100
+ table: {
101
+ type: { summary: 'boolean' },
102
+ defaultValue: { summary: true },
103
+ },
104
+ },
105
+ showPrefix: {
106
+ name: 'showPrefix',
107
+ type: { name: 'boolean', required: false },
108
+ defaultValue: false,
109
+ description: 'Show/Hide author/reviewer prefix',
110
+ table: {
111
+ type: { summary: 'boolean' },
112
+ defaultValue: { summary: false },
113
+ },
114
+ },
115
+ showTitle: {
116
+ name: 'showTitle',
117
+ type: { name: 'boolean', required: false },
118
+ defaultValue: true,
119
+ description: 'Show/Hide links',
120
+ table: {
121
+ type: { summary: 'boolean' },
122
+ defaultValue: { summary: true },
123
+ },
124
+ },
125
+ type: {
126
+ name: 'type',
127
+ type: { name: 'string', required: false },
128
+ defaultValue: 'default',
129
+ description: 'Page template - change prefix based on this',
130
+ table: {
131
+ type: { summary: 'string' },
132
+ defaultValue: { summary: '' },
133
+ },
134
+ },
135
+ },
136
+ parameters: {
137
+ docs: {
138
+ description: {
139
+ component: 'AuthorTemplateOne component',
140
+ },
141
+ page: () => (
142
+ <>
143
+ <Title />
144
+ <Description />
145
+ <Primary />
146
+ <ArgsTable story={PRIMARY_STORY} />
147
+ </>
148
+ ),
149
+ },
150
+ },
151
+ };
152
+
153
+ const Template = (args) => <AuthorTemplateOne {...args} />;
154
+
155
+ export const Default = Template.bind({});
@@ -0,0 +1,172 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import TemplateThree from '.';
4
+
5
+ describe('AuthorTemplateOne Component', () => {
6
+ it('renders author name in desired format when authorTemplateTwo is false', () => {
7
+ const { container } = render(
8
+ <TemplateThree
9
+ authorName="John Doe"
10
+ authorPath="/path-to-author"
11
+ authorTitle="casino expert"
12
+ />
13
+ );
14
+
15
+ expect(container.querySelectorAll('a')).toHaveLength(1);
16
+ expect(container.querySelector('a')).toHaveAttribute('href', '/path-to-author');
17
+ });
18
+ test('Show Author data', () => {
19
+ const { container } = render(
20
+ <TemplateThree
21
+ authorName="John Author"
22
+ authorPath="/john-author"
23
+ authorTitle="casino expert"
24
+ />
25
+ );
26
+
27
+ expect(container.querySelector('.authorContainer')).toBeTruthy();
28
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('John Author');
29
+ expect(container.querySelector('.authorContainer a')).toHaveAttribute('href', '/john-author');
30
+ });
31
+ test('Show Author without as a link', () => {
32
+ const { container } = render(
33
+ <TemplateThree
34
+ authorName="John Author"
35
+ authorPath="/john-author"
36
+ authorTitle="casino expert"
37
+ showLinks={false}
38
+ />
39
+ );
40
+
41
+ expect(container.querySelector('.authorContainer')).toBeTruthy();
42
+ expect(container.querySelector('.authorContainer p')).toHaveTextContent('John Author');
43
+ expect(container.querySelector('.authorContainer')).not.toHaveAttribute('href', '/john-author');
44
+ });
45
+ test('Show Author title', () => {
46
+ const { container } = render(
47
+ <TemplateThree
48
+ authorName="John Author"
49
+ authorPath="/john-author"
50
+ authorTitle="casino expert"
51
+ />
52
+ );
53
+
54
+ expect(container.querySelector('.authorContainer')).toBeTruthy();
55
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('John Author');
56
+ expect(container.querySelector('.authorTitle')).toBeTruthy();
57
+ expect(container.querySelector('.authorTitle')).toHaveTextContent('casino expert');
58
+ });
59
+ test('Hide Author title', () => {
60
+ const { container } = render(
61
+ <TemplateThree
62
+ authorName="John Author"
63
+ authorPath="/john-author"
64
+ authorTitle="casino expert"
65
+ showTitle={false}
66
+ />
67
+ );
68
+
69
+ expect(container.querySelector('.authorContainer')).toBeTruthy();
70
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('John Author');
71
+ expect(container.querySelector('.authorTitle')).toBeFalsy();
72
+ });
73
+ test('Show Reviewer data', () => {
74
+ const { container } = render(
75
+ <TemplateThree
76
+ authorName="Jane Reviewer"
77
+ authorPath="/jane-reviewer"
78
+ authorTitle="casino expert"
79
+ isReviewer
80
+ />
81
+ );
82
+
83
+ expect(container.querySelector('.authorContainer')).toBeTruthy();
84
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('Jane Reviewer');
85
+ expect(container.querySelector('.authorContainer a')).toHaveAttribute('href', '/jane-reviewer');
86
+ });
87
+ test('Show Reviewer title', () => {
88
+ const { container } = render(
89
+ <TemplateThree
90
+ authorName="Jane Reviewer"
91
+ authorPath="/jane-reviewer"
92
+ authorTitle="casino expert"
93
+ isReviewer
94
+ showTitle={false}
95
+ />
96
+ );
97
+
98
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('Jane Reviewer');
99
+ expect(container.querySelector('.reviewerTitle')).toBeTruthy();
100
+ expect(container.querySelector('.reviewerTitle')).toHaveTextContent('Fact-checker');
101
+ });
102
+ test('Hide Reviewer title', () => {
103
+ const { container } = render(
104
+ <TemplateThree
105
+ authorName="Jane Reviewer"
106
+ authorPath="/jane-reviewer"
107
+ authorTitle="casino expert"
108
+ isReviewer
109
+ />
110
+ );
111
+
112
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('Jane Reviewer');
113
+ expect(container.querySelector('.reviewerTitle')).toBeFalsy();
114
+ });
115
+ test('Show Reviewer verification icon', () => {
116
+ const { container } = render(
117
+ <TemplateThree
118
+ authorName="Jane Reviewer"
119
+ authorPath="/jane-reviewer"
120
+ authorTitle="casino expert"
121
+ isReviewer
122
+ showTitle={false}
123
+ />
124
+ );
125
+ const verificationIcon = expect(container.querySelector('.reviewerTitle svg'));
126
+
127
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('Jane Reviewer');
128
+ expect(container.querySelector('.reviewerTitle')).toBeTruthy();
129
+ expect(container.querySelector('.reviewerTitle')).toHaveTextContent('Fact-checker');
130
+
131
+ verificationIcon.toBeTruthy();
132
+ });
133
+ test('Hide Reviewer verification icon', () => {
134
+ const { container } = render(
135
+ <TemplateThree
136
+ authorName="Jane Reviewer"
137
+ authorPath="/jane-reviewer"
138
+ authorTitle="casino expert"
139
+ isReviewer
140
+ showVerification={false}
141
+ showTitle={false}
142
+ />
143
+ );
144
+
145
+ expect(container.querySelector('.authorContainer a')).toHaveTextContent('Jane Reviewer');
146
+ expect(container.querySelector('.reviewerTitle')).toBeTruthy();
147
+ expect(container.querySelector('.reviewerTitle')).toHaveTextContent('Fact-checker');
148
+ expect(container.querySelector('.reviewerTitle svg')).toBeFalsy();
149
+ });
150
+ test('Show Reviewer without as a link', () => {
151
+ const { container } = render(
152
+ <TemplateThree
153
+ authorName="Jane Reviewer"
154
+ authorPath="/jane-reviewer"
155
+ authorTitle="casino expert"
156
+ showLinks={false}
157
+ isReviewer
158
+ />
159
+ );
160
+
161
+ expect(container.querySelector('.authorContainer')).toBeTruthy();
162
+ expect(container.querySelector('.authorContainer p')).toHaveTextContent('Jane Reviewer');
163
+ expect(container.querySelector('.authorContainer')).not.toHaveAttribute(
164
+ 'href',
165
+ '/jane-reviewer'
166
+ );
167
+ });
168
+ });
169
+
170
+ afterEach(() => {
171
+ cleanup();
172
+ });
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
4
4
  import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
5
  import Link from 'gatsby-core-theme/src/hooks/link';
6
- import styles from './author-template.module.scss';
6
+ import styles from './template-two.module.scss';
7
7
 
8
8
  const AuthorTemplateTwo = ({
9
9
  authorName,
@@ -21,7 +21,7 @@ export default {
21
21
  parameters: {
22
22
  docs: {
23
23
  description: {
24
- component: 'AuthorTemplateOne component',
24
+ component: 'AffiliateDiscalimer component',
25
25
  },
26
26
  page: () => (
27
27
  <>
@@ -25,19 +25,22 @@ const InfoGridItem = ({
25
25
  showAll: showMore,
26
26
  setShowMore,
27
27
  });
28
+ const showGrid = (templateThree && value) || !templateThree; // hide entire cell if empty on author info grid only
28
29
 
29
30
  return (
30
- <div
31
- className={`${templateTwo ? styles.columnItem || '' : styles.gridItem || ''} ${
32
- templateThree ? styles.templateThree || '' : ''
33
- }`}
34
- >
35
- <span>
36
- {showEmojis ? title : removeEmojis(title)}
37
- {showHyphen && ':'}
38
- </span>
39
- <span>{value || '-'}</span>
40
- </div>
31
+ showGrid && (
32
+ <div
33
+ className={`${templateTwo ? styles.columnItem || '' : styles.gridItem || ''} ${
34
+ templateThree ? styles.templateThree || '' : ''
35
+ }`}
36
+ >
37
+ <span>
38
+ {showEmojis ? title : removeEmojis(title)}
39
+ {showHyphen && ':'}
40
+ </span>
41
+ <span>{value || '-'}</span>
42
+ </div>
43
+ )
41
44
  );
42
45
  };
43
46