gatsby-matrix-theme 2.3.7 → 2.3.8

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/CHANGELOG.md +20 -0
  2. package/package.json +2 -2
  3. package/src/components/atoms/author-card/author-card.module.scss +44 -0
  4. package/src/components/atoms/author-card/author-card.stories.js +47 -0
  5. package/src/components/atoms/author-card/author-card.test.js +29 -0
  6. package/src/components/atoms/author-card/index.js +41 -0
  7. package/src/components/atoms/cards/operator-card/index.js +1 -1
  8. package/src/components/atoms/social-icons/index.js +50 -0
  9. package/src/components/atoms/social-icons/social-icons.module.scss +33 -0
  10. package/src/components/atoms/social-icons/social-icons.stories.js +55 -0
  11. package/src/components/atoms/social-icons/social-icons.test.js +31 -0
  12. package/src/components/pages/contact-us/contact-us.module.scss +86 -0
  13. package/src/components/pages/contact-us/contact-us.stories.js +92 -0
  14. package/src/components/pages/contact-us/contact-us.test.js +26 -0
  15. package/src/components/pages/contact-us/index.js +85 -3
  16. package/src/gatsby-core-theme/components/organisms/head/index.js +4 -6
  17. package/storybook/public/0.df565bea.iframe.bundle.js +1 -0
  18. package/storybook/public/{1.b16d9cbb.iframe.bundle.js → 1.d51717ce.iframe.bundle.js} +1 -1
  19. package/storybook/public/10.f7f3ccb8.iframe.bundle.js +1 -0
  20. package/storybook/public/11.13224d48.iframe.bundle.js +1 -0
  21. package/storybook/public/12.977cb5d6.iframe.bundle.js +1 -0
  22. package/storybook/public/13.183d3f1c.iframe.bundle.js +1 -0
  23. package/storybook/public/{10.f8a18169.iframe.bundle.js → 14.708f714b.iframe.bundle.js} +1 -1
  24. package/storybook/public/{11.7ed16ae2.iframe.bundle.js → 15.f1ca69f8.iframe.bundle.js} +1 -1
  25. package/storybook/public/5.f16ccaac.iframe.bundle.js +3 -0
  26. package/storybook/public/{5.3bdb3f72.iframe.bundle.js.LICENSE.txt → 5.f16ccaac.iframe.bundle.js.LICENSE.txt} +0 -0
  27. package/storybook/public/5.f16ccaac.iframe.bundle.js.map +1 -0
  28. package/storybook/public/6.25868236.iframe.bundle.js +1 -0
  29. package/storybook/public/7.11db31fe.iframe.bundle.js +1 -0
  30. package/storybook/public/{8.1df784e4.iframe.bundle.js → 8.d69edd98.iframe.bundle.js} +3 -3
  31. package/storybook/public/{8.1df784e4.iframe.bundle.js.LICENSE.txt → 8.d69edd98.iframe.bundle.js.LICENSE.txt} +0 -0
  32. package/storybook/public/8.d69edd98.iframe.bundle.js.map +1 -0
  33. package/storybook/public/{9.d2817f50.iframe.bundle.js → 9.e97b6f53.iframe.bundle.js} +1 -1
  34. package/storybook/public/iframe.html +1 -1
  35. package/storybook/public/main.6d313455.iframe.bundle.js +1 -0
  36. package/storybook/public/runtime~main.9c675b2b.iframe.bundle.js +1 -0
  37. package/storybook/public/vendors~main.2fa2d82b.iframe.bundle.js +7 -0
  38. package/storybook/public/{vendors~main.364411ac.iframe.bundle.js.LICENSE.txt → vendors~main.2fa2d82b.iframe.bundle.js.LICENSE.txt} +0 -0
  39. package/storybook/public/vendors~main.2fa2d82b.iframe.bundle.js.map +1 -0
  40. package/storybook/public/0.32053ec6.iframe.bundle.js +0 -1
  41. package/storybook/public/5.3bdb3f72.iframe.bundle.js +0 -3
  42. package/storybook/public/5.3bdb3f72.iframe.bundle.js.map +0 -1
  43. package/storybook/public/6.d5dd48d0.iframe.bundle.js +0 -1
  44. package/storybook/public/7.99f26915.iframe.bundle.js +0 -1
  45. package/storybook/public/8.1df784e4.iframe.bundle.js.map +0 -1
  46. package/storybook/public/main.b9b80be9.iframe.bundle.js +0 -1
  47. package/storybook/public/runtime~main.76a8717d.iframe.bundle.js +0 -1
  48. package/storybook/public/vendors~main.364411ac.iframe.bundle.js +0 -7
  49. package/storybook/public/vendors~main.364411ac.iframe.bundle.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [2.3.8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v2.3.7...v2.3.8) (2021-11-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * contact us page template ([4960ca9](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4960ca912a5eb8f0b2f9ce6aaf27a27d84cbe7be))
7
+ * contact us template ([d85be6f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d85be6fee147dd9f7b998865df12d9f41358a01c))
8
+ * follow us ([02699fc](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/02699fc26abf94f85c844e2716728d85f0853e68))
9
+ * merged master branch ([cb5ce66](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/cb5ce66f2882e9da0e3bd8c25daf85eab8aec941))
10
+ * style issue ([8694bf7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8694bf7e92c802166d85b1da3202f6713767ac7c))
11
+
12
+
13
+ ### Config
14
+
15
+ * updated core theme version ([6bf96c3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6bf96c35a1d720c19bf748e9b5ab82220f057b40))
16
+
17
+
18
+ * Merge branch 'tm-2565-matrix-contact-us' into 'master' ([917bfc1](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/917bfc1747da5a96e5b8e67db8eb43641b568ad8))
19
+ * Merge branch 'master' into tm-2565-matrix-contact-us ([a4a682f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a4a682fc9355a9f97c68196d8feaf235f6935fca))
20
+
1
21
  ## [2.3.7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v2.3.6...v2.3.7) (2021-11-22)
2
22
 
3
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "2.3.7",
3
+ "version": "2.3.8",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -31,7 +31,7 @@
31
31
  "cross-env": "^7.0.2",
32
32
  "dotenv": "8.2.0",
33
33
  "gatsby": "^3.3.1",
34
- "gatsby-core-theme": "^1.6.5",
34
+ "gatsby-core-theme": "^1.6.6",
35
35
  "gatsby-image": "^3.3.0",
36
36
  "gatsby-plugin-image": "^1.3.1",
37
37
  "gatsby-plugin-postcss": "^4.3.0",
@@ -0,0 +1,44 @@
1
+ .authorCard {
2
+ width: 100%;
3
+ background: var(--color-2);
4
+ border-radius: var(--border-radius);
5
+ @include flex-direction(row);
6
+ padding: 1.6rem;
7
+ .img {
8
+ width: 6rem;
9
+ height: 6rem;
10
+ img {
11
+ width: 100%;
12
+ height: 100%;
13
+ border-radius: 50%;
14
+ }
15
+ }
16
+ .txt {
17
+ padding-left: 1.2rem;
18
+ height: 6rem;
19
+ @include flex-direction(column);
20
+ align-content: center;
21
+ justify-content: center;
22
+ div {
23
+ line-height: 1.8rem;
24
+ }
25
+ }
26
+ .name {
27
+ font-weight: 600;
28
+ font-size: 1.6rem;
29
+ color: var(--color-33);
30
+ line-height: 2.4rem;
31
+ }
32
+ .position {
33
+ font-weight: normal;
34
+ font-size: 1.2rem;
35
+ color: var(--color-32);
36
+ margin: 0.4rem 0 0 0;
37
+ }
38
+ .email {
39
+ font-weight: 600;
40
+ font-size: 1.2rem;
41
+ line-height: 1.8rem;
42
+ color:var(--color-51);
43
+ }
44
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ PRIMARY_STORY,
8
+ ArgsTable,
9
+ } from '@storybook/addon-docs/blocks';
10
+ import { authors } from 'gatsby-core-theme/tests/factories/modules/contact-us-authors.factory';
11
+ import AuthorCard from '.';
12
+
13
+ const authorsKeys = Object.keys(authors);
14
+
15
+ export default {
16
+ title: 'Matrix-Theme/Atoms/Author Card',
17
+ component: AuthorCard,
18
+ argTypes: {
19
+ author: {
20
+ name: 'author',
21
+ type: { name: 'object', required: true },
22
+ defaultValue: '',
23
+ description: 'author object data',
24
+ },
25
+ },
26
+ parameters: {
27
+ docs: {
28
+ description: {
29
+ component: 'A component that displays authors cards',
30
+ },
31
+ page: () => (
32
+ <>
33
+ <Title />
34
+ <Description />
35
+ <Primary />
36
+ <ArgsTable story={PRIMARY_STORY} />
37
+ </>
38
+ ),
39
+ },
40
+ },
41
+ };
42
+
43
+ const Template = (args) => <AuthorCard {...args} />;
44
+ export const Default = Template.bind({});
45
+ Default.args = {
46
+ author: authors[authorsKeys[0]],
47
+ };
@@ -0,0 +1,29 @@
1
+ /* eslint-disable camelcase */
2
+ import React from 'react';
3
+ import { render, cleanup } from '@testing-library/react';
4
+ import { authors } from 'gatsby-core-theme/tests/factories/modules/contact-us-authors.factory';
5
+ import '@testing-library/jest-dom/extend-expect';
6
+ import AuthorCard from '.';
7
+
8
+ const authorsKeys = Object.keys(authors);
9
+
10
+ describe('AuthorCard Component', () => {
11
+ test('render one author', () => {
12
+ const { container } = render(<AuthorCard author={authors[authorsKeys[0]]} />);
13
+ const { name } = authors[authorsKeys[0]];
14
+ expect(container).toBeTruthy();
15
+ expect(container.querySelector('.name').innerHTML).toEqual(name);
16
+ });
17
+
18
+ test('render each author', () => {
19
+ Object.keys(authors).forEach((author) => {
20
+ const { name, email_address } = authors[author];
21
+ const { container } = render(<AuthorCard author={authors[author]} />);
22
+ expect(container.querySelector('.name').innerHTML).toEqual(name);
23
+ expect(container.querySelector('a').innerHTML).toEqual(email_address);
24
+ });
25
+ });
26
+ });
27
+ afterEach(() => {
28
+ cleanup();
29
+ });
@@ -0,0 +1,41 @@
1
+ /* eslint-disable camelcase */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
+ import { imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
6
+ import styles from './author-card.module.scss';
7
+
8
+ const AuthorCard = ({ author }) => {
9
+ const { name, author_title, email_address, image } = author || {};
10
+
11
+ return (
12
+ <div className={styles.authorCard}>
13
+ <div className={styles.img}>
14
+ <LazyImage src={imagePrettyUrl(image)} alt={name} />
15
+ </div>
16
+ <div className={styles.txt}>
17
+ <div className={styles.name}>{name}</div>
18
+ <div className={styles.position}>{author_title}</div>
19
+ <a
20
+ className={styles.email}
21
+ href={`mailto:${email_address}`}
22
+ target="_blank"
23
+ rel="noreferrer"
24
+ >
25
+ {email_address}
26
+ </a>
27
+ </div>
28
+ </div>
29
+ );
30
+ };
31
+
32
+ AuthorCard.propTypes = {
33
+ author: PropTypes.shape({
34
+ name: PropTypes.string,
35
+ author_title: PropTypes.string,
36
+ email_address: PropTypes.string,
37
+ image: PropTypes.string,
38
+ }).isRequired,
39
+ };
40
+
41
+ export default AuthorCard;
@@ -74,7 +74,7 @@ const OperatorCard = ({ item, featured = false, number }) => {
74
74
  {isActive && (
75
75
  <Button
76
76
  to={prettyLink}
77
- btnText={translate(translations, 'play_now', 'Sign Up')}
77
+ btnText={translate(translations, 'play_now', 'Play Now')}
78
78
  isInternalLink={false}
79
79
  disabled={!isActive}
80
80
  gtmClass="operator-card-gtm btn-cta"
@@ -0,0 +1,50 @@
1
+ import React, { useContext } from 'react';
2
+ import { FaInstagram, FaFacebookSquare, FaTwitter, FaLinkedin, FaYoutube } from 'react-icons/fa';
3
+ import PropTypes from 'prop-types';
4
+ import keygen from 'gatsby-core-theme/src/helpers/keygen';
5
+ import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
6
+ import { translate } from '~helpers/getters';
7
+ import styles from './social-icons.module.scss';
8
+
9
+ const SocialIcons = ({ socialIcons }) => {
10
+ const { translations } = useContext(Context) || {};
11
+ const keys = Object.keys(socialIcons);
12
+ const switchIcons = (icons) => {
13
+ switch (icons) {
14
+ case 'instagram':
15
+ return <FaInstagram />;
16
+ case 'facebook':
17
+ return <FaFacebookSquare />;
18
+ case 'twitter':
19
+ return <FaTwitter />;
20
+ case 'linkedin':
21
+ return <FaLinkedin />;
22
+ case 'youtube':
23
+ return <FaYoutube />;
24
+ default:
25
+ return null;
26
+ }
27
+ };
28
+
29
+ return (
30
+ <div className={styles.container}>
31
+ <div className={styles.title}>{translate(translations, 'follow_us', 'Follow Us')}</div>
32
+ <div className={styles.socialIcons}>
33
+ {keys.map(
34
+ (key) =>
35
+ socialIcons[key] && (
36
+ <a key={keygen()} href={socialIcons[key]} target="_blank" rel="noreferrer">
37
+ {switchIcons(key)}
38
+ </a>
39
+ )
40
+ )}
41
+ </div>
42
+ </div>
43
+ );
44
+ };
45
+
46
+ export default SocialIcons;
47
+
48
+ SocialIcons.propTypes = {
49
+ socialIcons: PropTypes.shape({}),
50
+ };
@@ -0,0 +1,33 @@
1
+ .container {
2
+ width: 100%;
3
+ @include flex-direction(column);
4
+ .title{
5
+ padding-bottom: 1.6rem;
6
+ font-weight: 600;
7
+ font-size: 1.6rem;
8
+ line-height: 2.4rem;
9
+ color: var(--color-33);
10
+ @include min(tablet){
11
+ font-weight: bold;
12
+ font-size: 3.6rem;
13
+ line-height: 4.6rem;
14
+ }
15
+ }
16
+ .socialIcons{
17
+ display: inline-flex;
18
+ a {
19
+ display: inline-block;
20
+ width: 4rem;
21
+ height: 4rem;
22
+ line-height: 4.7rem;
23
+ border-radius: 50%;
24
+ background: var(--color-52);
25
+ margin: 0 1.6rem 0 0;
26
+ text-align: center;
27
+ font-size: 2rem;
28
+ svg{
29
+ color: var(--color-16);
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ PRIMARY_STORY,
8
+ ArgsTable,
9
+ } from '@storybook/addon-docs/blocks';
10
+ import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
11
+ import SocialIcons from '.';
12
+
13
+ const socialIcons =
14
+ siteSchema &&
15
+ (({ instagram, facebook, twitter, linkedin, youtube }) => ({
16
+ instagram,
17
+ facebook,
18
+ twitter,
19
+ linkedin,
20
+ youtube,
21
+ }))(siteSchema);
22
+
23
+ export default {
24
+ title: 'Matrix-Theme/Atoms/Social Icons',
25
+ component: SocialIcons,
26
+ argTypes: {
27
+ socialIcons: {
28
+ name: 'social icons',
29
+ type: { name: 'object', required: true },
30
+ defaultValue: '',
31
+ description: 'social icons object data',
32
+ },
33
+ },
34
+ parameters: {
35
+ docs: {
36
+ description: {
37
+ component: 'A component that displays social icons',
38
+ },
39
+ page: () => (
40
+ <>
41
+ <Title />
42
+ <Description />
43
+ <Primary />
44
+ <ArgsTable story={PRIMARY_STORY} />
45
+ </>
46
+ ),
47
+ },
48
+ },
49
+ };
50
+
51
+ const Template = (args) => <SocialIcons {...args} />;
52
+ export const Default = Template.bind({});
53
+ Default.args = {
54
+ socialIcons,
55
+ };
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
5
+ import SocialIcons from '.';
6
+
7
+ const socialIcons =
8
+ siteSchema &&
9
+ (({ instagram, facebook, twitter, linkedin, youtube }) => ({
10
+ instagram,
11
+ facebook,
12
+ twitter,
13
+ linkedin,
14
+ youtube,
15
+ }))(siteSchema);
16
+
17
+ const socialIconsLength = Object.keys(socialIcons);
18
+
19
+ describe('SocialIcons Component', () => {
20
+ test('render with props and social icons list', () => {
21
+ const { container } = render(<SocialIcons socialIcons={socialIcons} />);
22
+ expect(container).toBeTruthy();
23
+ const socialLinksWrapper = container.querySelector('.socialIcons');
24
+ expect(socialLinksWrapper.querySelectorAll('a')).toHaveLength(socialIconsLength.length);
25
+ expect(socialLinksWrapper.querySelectorAll('a')[2].innerText).toEqual(siteSchema[2]);
26
+ expect(socialLinksWrapper.querySelectorAll('a')[4].innerText).toEqual(siteSchema[4]);
27
+ });
28
+ });
29
+ afterEach(() => {
30
+ cleanup();
31
+ });
@@ -0,0 +1,86 @@
1
+ .pageContainer {
2
+ background-color: white;
3
+ padding: 6rem 0 0;
4
+ @include min(laptop) {
5
+ padding: 8rem 0 0;
6
+ }
7
+ .contactUsContainer {
8
+ max-width: var(--main-container-max);
9
+ margin: 0 auto;
10
+ @include flex-direction(column);
11
+ padding: 1.6rem 2.4rem;
12
+ background-color: transparent;
13
+
14
+ header{
15
+ padding-top: 0;
16
+ > div{
17
+ padding: 0;
18
+ a, li{
19
+ font-weight: normal;
20
+ font-size: 1.4rem;
21
+ line-height: 2.4rem;
22
+ color:var(--color-41);
23
+ }
24
+ div:last-of-type{
25
+ display: none;
26
+ }
27
+ }
28
+ }
29
+
30
+ .contactBox {
31
+ width: 100%;
32
+ padding-top: 1.2rem;
33
+ padding-bottom: 4.6rem;
34
+ border-radius: var(--border-radius);
35
+ @include min(tablet) {
36
+ @include flex-direction(row);
37
+ padding-bottom: 3.3rem;
38
+ }
39
+ }
40
+ .formWrapper {
41
+ flex-basis: 100%;
42
+ padding: 0;
43
+ p {
44
+ font-weight: normal;
45
+ font-size: 1.6rem;
46
+ line-height: 2.4rem;
47
+ color: var(--color-38);
48
+ padding-top: 0.8rem;
49
+ }
50
+ h1 {
51
+ margin: 0;
52
+ font-weight: bold;
53
+ font-size: 3.6rem;
54
+ line-height: 4.6rem;
55
+ color: var(--color-33);
56
+ }
57
+ @include min(tablet) {
58
+ flex-basis: 61rem;
59
+ padding-right: 3.3rem;
60
+ }
61
+ }
62
+ .authors {
63
+ width: 100%;
64
+ @include min(desktop) {
65
+ }
66
+ ul {
67
+ width: 100%;
68
+ @include flex-direction(column);
69
+ @include min(tablet) {
70
+ display: grid;
71
+ grid-template-columns: 1fr 1fr;
72
+ grid-gap: 1.6rem;
73
+ }
74
+ @include min(desktop) {
75
+ grid-template-columns: 1fr 1fr 1fr;
76
+ }
77
+ li {
78
+ margin-bottom: 1.6rem;
79
+ @include min(tablet) {
80
+ margin-bottom: 0;
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import {
4
+ Title,
5
+ Description,
6
+ Primary,
7
+ PRIMARY_STORY,
8
+ ArgsTable,
9
+ } from '@storybook/addon-docs/blocks';
10
+ // import { singleToplistData } from 'gatsby-core-theme/tests/factories/modules/toplist.factory';
11
+ import { authors } from 'gatsby-core-theme/tests/factories/modules/contact-us-authors.factory';
12
+ import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
13
+
14
+ // import PopupCard from '.';
15
+ import ContactUs from '.';
16
+
17
+ const page = {};
18
+ page.authors = { ...authors };
19
+ page.siteSchema = { ...siteSchema };
20
+
21
+ export default {
22
+ title: 'Matrix-Theme/Pages/Contact Us',
23
+ component: ContactUs,
24
+ argTypes: {
25
+ page: {
26
+ name: 'page',
27
+ type: { name: 'object', required: true },
28
+ defaultValue: '',
29
+ description: 'page object',
30
+ siteSchema: {
31
+ type: { summary: 'object' },
32
+ defaultValue: { summary: '' },
33
+ },
34
+ authors: {
35
+ type: { summary: 'object' },
36
+ defaultValue: { summary: '' },
37
+ },
38
+ },
39
+ hasHeader: {
40
+ name: 'hasHeader',
41
+ type: { name: 'bool', required: true },
42
+ defaultValue: true,
43
+ description: 'page Header',
44
+ },
45
+ submitUrl: {
46
+ name: 'submitUrl',
47
+ type: { name: 'string', required: false },
48
+ defaultValue: null,
49
+ description: 'submit URL',
50
+ },
51
+ successMessage: {
52
+ name: 'successMessage',
53
+ type: { name: 'string', required: false },
54
+ defaultValue: 'Message sent successfully.',
55
+ description: 'sent message text',
56
+ },
57
+ failMessage: {
58
+ name: 'failMessage',
59
+ type: { name: 'string', required: false },
60
+ defaultValue: 'Message not sent.',
61
+ description: 'fail message text',
62
+ },
63
+ validationMessage: {
64
+ name: 'validationMessage',
65
+ type: { name: 'string', required: false },
66
+ defaultValue: 'Fill all the required fields.',
67
+ description: 'sent message info',
68
+ },
69
+ },
70
+ parameters: {
71
+ docs: {
72
+ description: {
73
+ component: 'A component that displays Contact Us page',
74
+ },
75
+ page: () => (
76
+ <>
77
+ <Title />
78
+ <Description />
79
+ <Primary />
80
+ <ArgsTable story={PRIMARY_STORY} />
81
+ </>
82
+ ),
83
+ },
84
+ },
85
+ };
86
+
87
+ const Template = (args) => <ContactUs {...args} />;
88
+ export const Default = Template.bind({});
89
+ Default.args = {
90
+ page,
91
+ hasHeader: false,
92
+ };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import { authors } from 'gatsby-core-theme/tests/factories/modules/contact-us-authors.factory';
5
+ import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
6
+ import ContactUs from '.';
7
+
8
+ describe('ContactUs Component', () => {
9
+ const page = {};
10
+ page.authors = { ...authors };
11
+ page.siteSchema = { ...siteSchema };
12
+ const authorLength = Object.keys(authors).length;
13
+
14
+ test('render with props, authors and social icons list', () => {
15
+ const { container } = render(<ContactUs page={page} hasHeader={false} submitUrl="submit" />);
16
+ expect(container).toBeTruthy();
17
+ const authorsListContainer = container.querySelector('ul');
18
+ expect(authorsListContainer.querySelectorAll('li')).toHaveLength(authorLength);
19
+ expect(container.querySelector('H1').innerHTML).toBe('Contact Us');
20
+ const socialListContainer = container.querySelector('.socialIcons');
21
+ expect(socialListContainer.querySelectorAll('a')).toHaveLength(5);
22
+ });
23
+ });
24
+ afterEach(() => {
25
+ cleanup();
26
+ });
@@ -1,9 +1,91 @@
1
- import React from 'react';
1
+ /* eslint-disable react/no-unescaped-entities */
2
+ import React, { useContext } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import keygen from 'gatsby-core-theme/src/helpers/keygen';
5
+ import { Context } from 'gatsby-core-theme/src/context/TranslationsProvider';
6
+ import Form from 'gatsby-core-theme/src/components/organisms/form';
7
+ import Header from '../../molecules/header';
8
+ import AuthorCard from '../../atoms/author-card';
9
+ import SocialIcons from '../../atoms/social-icons';
10
+ import styles from './contact-us.module.scss';
11
+ import { translate } from '~helpers/getters';
12
+
13
+ const ContactUs = ({
14
+ page,
15
+ hasHeader = true,
16
+ submitUrl,
17
+ successMessage = 'Message sent successfully.',
18
+ failMessage = 'Message failed to send.',
19
+ validationMessage = 'Fill all the required fields.',
20
+ }) => {
21
+ const { translations } = useContext(Context) || {};
22
+
23
+ const { siteSchema, authors } = page || {};
24
+ const authorsObjKeys = authors && Object.keys(authors);
25
+ const socialIcons =
26
+ siteSchema &&
27
+ (({ instagram, facebook, twitter, linkedin, youtube }) => ({
28
+ instagram,
29
+ facebook,
30
+ twitter,
31
+ linkedin,
32
+ youtube,
33
+ }))(siteSchema);
2
34
 
3
- const ContactUs = () => {
4
35
  return (
5
- <>this component created as a template and will be overridden in each matrix site</>
36
+ <div className={styles.pageContainer}>
37
+ <div className={styles.contactUsContainer}>
38
+ {hasHeader && <Header section={page} />}
39
+ <div className={styles.contactBox}>
40
+ <div className={styles.formWrapper}>
41
+ <h1>{translate(translations, 'contact_us', 'Contact Us')}</h1>
42
+ <p>
43
+ {translate(
44
+ translations,
45
+ 'contact_us_questions',
46
+ `If you have questions about our reviews, games or content, or just want to leave some
47
+ feedback, the Irish Luck team would love to hear from you. You can contact us any time
48
+ using the details below and we'll endeavour to get back to you within 48 hours.`
49
+ )}
50
+ </p>
51
+ <Form
52
+ hasButton
53
+ buttonLabel="Send"
54
+ submitUrl={submitUrl}
55
+ successMessage={successMessage}
56
+ failMessage={failMessage}
57
+ validationMessage={validationMessage}
58
+ />
59
+ </div>
60
+ <div className={styles.socialIcons}>
61
+ {siteSchema && <SocialIcons socialIcons={socialIcons} />}
62
+ </div>
63
+ </div>
64
+ <div className={styles.authors}>
65
+ <ul>
66
+ {authors &&
67
+ authorsObjKeys.map((key) => (
68
+ <li key={keygen()}>
69
+ <AuthorCard author={authors[key]} />
70
+ </li>
71
+ ))}
72
+ </ul>
73
+ </div>
74
+ </div>
75
+ </div>
6
76
  );
7
77
  };
8
78
 
9
79
  export default ContactUs;
80
+
81
+ ContactUs.propTypes = {
82
+ page: PropTypes.shape({
83
+ siteSchema: PropTypes.shape({}),
84
+ authors: PropTypes.shape({}),
85
+ }).isRequired,
86
+ hasHeader: PropTypes.bool.isRequired,
87
+ submitUrl: PropTypes.string,
88
+ successMessage: PropTypes.string,
89
+ failMessage: PropTypes.string,
90
+ validationMessage: PropTypes.string,
91
+ };