gatsby-core-theme 3.0.0 → 5.0.1

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 (85) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/__mocks__/gatsby.js +16 -4
  3. package/gatsby-node.esm.js +7 -1
  4. package/jest.config.js +8 -1
  5. package/package.json +1 -1
  6. package/src/components/app.js +1 -17
  7. package/src/components/atoms/author/author.test.js +12 -5
  8. package/src/components/atoms/author-box/index.js +10 -11
  9. package/src/components/atoms/breadcrumbs/breadcrumbs.test.js +8 -0
  10. package/src/components/atoms/carousel/pagination-item/pagination-item.test.js +18 -3
  11. package/src/components/atoms/collapse/collapse.test.js +10 -0
  12. package/src/components/atoms/collapse/index.js +3 -1
  13. package/src/components/atoms/content-box/content-box.test.js +9 -6
  14. package/src/components/atoms/content-box/index.js +13 -12
  15. package/src/components/atoms/custom-select/index.js +31 -30
  16. package/src/components/atoms/disclaimer/disclaimer.test.js +16 -1
  17. package/src/components/atoms/iframe/iframe.module.scss +3 -0
  18. package/src/components/atoms/iframe/iframe.test.js +6 -0
  19. package/src/components/atoms/image/image.test.js +19 -6
  20. package/src/components/atoms/image/index.js +2 -4
  21. package/src/components/atoms/info-grid/index.js +10 -12
  22. package/src/components/atoms/label/index.js +2 -2
  23. package/src/components/atoms/label/label.test.js +4 -0
  24. package/src/components/atoms/module-title/index.js +9 -9
  25. package/src/components/atoms/module-title/module-title.test.js +76 -0
  26. package/src/components/atoms/open-graph/open-graph.test.js +34 -5
  27. package/src/components/atoms/operator-cta/operator-cta.test.js +26 -3
  28. package/src/components/atoms/scroll-to-top/scroll-to-top.test.js +6 -0
  29. package/src/components/atoms/search/autocomplete/operator.js +1 -1
  30. package/src/components/atoms/sitemap/index.js +1 -1
  31. package/src/components/atoms/spotlights/index.js +59 -54
  32. package/src/components/atoms/spotlights/spotlights.module.scss +25 -37
  33. package/src/components/atoms/spotlights/spotlights.test.js +13 -15
  34. package/src/components/molecules/carousel/default-slide/index.js +3 -1
  35. package/src/components/molecules/content/content.test.js +127 -0
  36. package/src/components/molecules/content/index.js +0 -1
  37. package/src/components/molecules/header/header.test.js +6 -0
  38. package/src/components/molecules/main/main.test.js +48 -12
  39. package/src/components/molecules/menu/menu.test.js +27 -0
  40. package/src/components/molecules/module/module.test.js +134 -0
  41. package/src/components/molecules/operator-banner/operator-banner.test.js +7 -1
  42. package/src/components/molecules/pagination/pagination-with-midpoints.module.scss +48 -49
  43. package/src/components/molecules/slider/index.js +6 -0
  44. package/src/components/organisms/anchor/index.js +14 -11
  45. package/src/components/organisms/carousel/index.js +16 -3
  46. package/src/components/organisms/cookie-consent/cookie-consent.test.js +7 -1
  47. package/src/components/organisms/form/form.test.js +21 -0
  48. package/src/components/organisms/form/index.js +5 -1
  49. package/src/components/organisms/navigation/index.js +9 -1
  50. package/src/components/organisms/search/index.js +0 -1
  51. package/src/components/organisms/toplist/list/index.js +1 -1
  52. package/src/components/organisms/toplist/list/list.test.js +30 -0
  53. package/src/components/pages/body/index.js +4 -6
  54. package/src/components/pages/tracker/index.js +1 -1
  55. package/src/constants/settings.js +1 -1
  56. package/src/helpers/getters.js +10 -6
  57. package/src/helpers/getters.test.js +1 -3
  58. package/src/helpers/processor/common.test.js +7 -1
  59. package/src/helpers/processor/index.js +2 -3
  60. package/src/helpers/processor/index.test.js +21 -0
  61. package/src/helpers/schema.js +14 -6
  62. package/src/helpers/schema.test.js +17 -14
  63. package/src/hooks/gatsby-img/index.js +1 -1
  64. package/src/hooks/lazy-image/index.js +37 -37
  65. package/src/hooks/lazy-image/lazy-image.test.js +39 -0
  66. package/src/hooks/lazy-picture/index.js +1 -1
  67. package/src/hooks/link/link.test.js +42 -1
  68. package/src/hooks/tabs/tab/tab.test.js +41 -0
  69. package/src/styles/utils/variables/_main.scss +3 -1
  70. package/tests/envVars.js +1 -1
  71. package/tests/factories/modules/content.factory.js +6 -3
  72. package/tests/factories/modules/modules.factory.js +152 -0
  73. package/tests/factories/modules/schema.factory.js +87 -0
  74. package/tests/factories/pages/list.factory.js +2 -1
  75. package/tests/factories/pages/pages.factory.js +192 -0
  76. package/tests/factories/sections/header.factory.js +8 -2
  77. package/src/components/atoms/logo/index.js +0 -36
  78. package/src/components/atoms/logo/logo.module.scss +0 -4
  79. package/src/components/atoms/logo/logo.stories.js +0 -57
  80. package/src/components/atoms/logo/logo.test.js +0 -30
  81. package/src/components/molecules/section/index.js +0 -24
  82. package/src/components/molecules/section/section.test.js +0 -16
  83. package/src/components/molecules/sidebar/index.js +0 -25
  84. package/src/components/molecules/sidebar/sidebar.module.scss +0 -3
  85. package/src/components/molecules/sidebar/sidebar.test.js +0 -30
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import {
3
- Title,
4
- Subtitle,
5
- Description,
6
- Primary,
7
- PRIMARY_STORY,
8
- ArgsTable,
9
- } from '@storybook/addon-docs/blocks';
10
-
11
- import Logo from '.';
12
-
13
- export default {
14
- title: 'Gatsby-Theme/Atoms/Logo',
15
- component: Logo,
16
- argTypes: {
17
- item: {
18
- name: 'item',
19
- type: { name: 'object', required: true },
20
- defaultValue: '',
21
- description: 'The logo item data object',
22
- table: {
23
- type: { summary: 'object' },
24
- defaultValue: { summary: '' },
25
- },
26
- },
27
- },
28
- parameters: {
29
- docs: {
30
- description: {
31
- component:
32
- 'A component that displays a linked lazy-loaded casino logo image.',
33
- },
34
- page: () => (
35
- <>
36
- <Title />
37
- <Subtitle />
38
- <Description />
39
- <Primary />
40
- <ArgsTable story={PRIMARY_STORY} />
41
- </>
42
- ),
43
- },
44
- },
45
- };
46
-
47
- const Template = (args) => <Logo {...args} />;
48
-
49
- export const Default = Template.bind({});
50
- Default.args = {
51
- item: {
52
- name: 'Rizk',
53
- short_name: 'Rizk',
54
- status : 'active',
55
- logo_url: 'rizk-logopng7ed316ac19-original.png',
56
- },
57
- };
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import Logo from '.';
6
- import testImage from '../../../images/logo.svg';
7
-
8
- describe('Logo Component', () => {
9
- test('render with props', () => {
10
- const { container } = render(
11
- <Logo
12
- item={{
13
- name: 'my log name',
14
- status: 'active',
15
- logo_url: testImage,
16
- short_name: 'url',
17
- type: 'type',
18
- }}
19
- />
20
- );
21
- const logoA = container.querySelector('a.operatorLogo');
22
- expect(logoA).toHaveAttribute('title', 'my log name');
23
- expect(logoA).toHaveAttribute('target', '_blank');
24
- expect(logoA).toHaveAttribute('rel', 'noopener noreferrer');
25
- expect(logoA).toHaveAttribute('href', `/no/visit/url`);
26
- });
27
- });
28
- afterEach(() => {
29
- cleanup();
30
- });
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- import Module from '~molecules/module';
5
- import keygen from '~helpers/keygen';
6
-
7
- const Section = ({ section }) => {
8
- return (
9
- <>
10
- {section.modules &&
11
- section.modules.map((module) => {
12
- return <Module key={keygen()} module={module} />;
13
- })}
14
- </>
15
- );
16
- };
17
-
18
- Section.propTypes = {
19
- section: PropTypes.shape({
20
- modules: PropTypes.arrayOf(PropTypes.object),
21
- }).isRequired,
22
- };
23
-
24
- export default Section;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import '~tests/helpers/match-media.mock';
6
- import Section from '.';
7
-
8
- describe('Section Component', () => {
9
- test('render whithout crash', () => {
10
- const { container } = render(<Section section={{ module: { name: 'content' } }} />);
11
- expect(container).toBeTruthy();
12
- });
13
- });
14
- afterEach(() => {
15
- cleanup();
16
- });
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- import Module from '~molecules/module';
5
- import keygen from '~helpers/keygen';
6
- import styles from './sidebar.module.scss';
7
-
8
- const Sidebar = ({ section }) => {
9
- return (
10
- <aside className={styles.sidebar}>
11
- {section.modules &&
12
- section.modules.map((module) => {
13
- return <Module key={keygen()} module={module} />;
14
- })}
15
- </aside>
16
- );
17
- };
18
-
19
- Sidebar.propTypes = {
20
- section: PropTypes.shape({
21
- modules: PropTypes.arrayOf(PropTypes.object),
22
- }).isRequired,
23
- };
24
-
25
- export default Sidebar;
@@ -1,3 +0,0 @@
1
- .sidebar {
2
- display: block;
3
- }
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { render, cleanup, waitFor } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import '~tests/helpers/match-media.mock';
6
- import { getSingleContentData } from '~tests/factories/modules/content.factory';
7
- import Sidebar from '.';
8
-
9
- const section = {
10
- modules: [
11
- {
12
- name: 'content',
13
- ...getSingleContentData()
14
- },
15
- ],
16
- };
17
-
18
- describe('Sidebar Component', () => {
19
- test('render sidebar', async () => {
20
- const { container, getByText } = render(<Sidebar section={section} />);
21
- expect(container).toBeTruthy();
22
- expect(container.querySelectorAll('aside')).toHaveLength(1);
23
- await waitFor(() => {
24
- expect(getByText('Test Content 1')).toBeTruthy();
25
- });
26
- });
27
- });
28
- afterEach(() => {
29
- cleanup();
30
- });