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
@@ -13,6 +13,7 @@ const Slide = ({
13
13
  primaryBtnText = '',
14
14
  secondaryBtnText = '',
15
15
  imageSizes = { width: null, height: 930 },
16
+ slideTitle = '',
16
17
  }) => {
17
18
  return (
18
19
  <>
@@ -21,7 +22,7 @@ const Slide = ({
21
22
  <LazyImage
22
23
  className={styles.image}
23
24
  src={imagePrettyUrl(item.image, imageSizes.width, imageSizes.height)}
24
- alt={item.title}
25
+ alt={item.title || slideTitle}
25
26
  />
26
27
  )}
27
28
  {item.content && <p className={styles.content}>{item.content}</p>}
@@ -62,6 +63,7 @@ Slide.propTypes = {
62
63
  primaryBtnText: PropTypes.string,
63
64
  secondaryBtnText: PropTypes.string,
64
65
  imageSizes: PropTypes.shape({ width: PropTypes.any, height: PropTypes.any }),
66
+ slideTitle: PropTypes.string,
65
67
  };
66
68
 
67
69
  export default Slide;
@@ -20,6 +20,133 @@ describe('Content Component', () => {
20
20
  // expect(container.querySelector('img')).toBeFalsy();
21
21
  // expect(container.querySelector('div.lazyload-placeholder')).toBeTruthy();
22
22
  });
23
+
24
+ test('Iframe props', () => {
25
+ const iframeModule = {
26
+ anchor_label: 'Slot tips',
27
+ anchor_slug: 'slot-tips',
28
+ anchored: 1,
29
+ background_color: null,
30
+ extra_anchors: null,
31
+ module_title: 'Tips when Choosing Slot Machines',
32
+ module_title_tag: 'h2',
33
+ module_value_id: 208480,
34
+ name: 'content',
35
+ see_more_link: null,
36
+ show_more_content: null,
37
+ show_more_enabled: '0',
38
+ show_more_label: null,
39
+ style: 'content_frame_style',
40
+ style_id: 41,
41
+ tag: 'h2',
42
+ title: 'Tips when Choosing Slot Machines',
43
+ value: `
44
+ <p>
45
+ Whether youre a newcomer to the world of online gambling, or whether you are a seasoned player with a desire to keep abreast of whats happening in the industry, youll find all the information you need, right here on Playcasino.</p>
46
+ <p>
47
+ <img src="https://assets-srv.s3.eu-west-1.amazonaws.com/online-casinos-in-south-africa.jpg" width="929px" id="67595" height="266px" alt="Online Casinos in South Africa" title="Online Casinos in South Africa" class="content-image--align-center fr-fic fr-dib">
48
+ </p>
49
+ <p>
50
+ <img src="https://assets-srv.s3.eu-west-1.amazonaws.com/online-casinos-in-south-africa.jpg" width="929px" id="67595" height="266px" alt="Online Casinos in South Africa" title="Online Casinos in South Africa" class="content-image--align-right fr-fic fr-dib">
51
+ </p>
52
+ <p>
53
+ <img src="https://assets-srv.s3.eu-west-1.amazonaws.com/online-casinos-in-south-africa.jpg" width="929px" id="67595" height="266px" alt="Online Casinos in South Africa" title="Online Casinos in South Africa" class="content-image--align-left fr-fic fr-dib">
54
+ </p>
55
+ <p>
56
+ <img src="https://assets-srv.s3.eu-west-1.amazonaws.com/online-casinos-in-south-africa.jpg" width="929px" id="67595" height="266px" alt="Online Casinos in South Africa" title="Online Casinos in South Africa" class="content-image--float-right fr-fic fr-dib">
57
+ </p>
58
+ <p>
59
+ <img src="https://assets-srv.s3.eu-west-1.amazonaws.com/online-casinos-in-south-africa.jpg" width="929px" id="67595" height="266px" alt="Online Casinos in South Africa" title="Online Casinos in South Africa" class="content-image--float-left fr-fic fr-dib">
60
+ </p>
61
+ <p>&nbsp;</p>
62
+ <p>
63
+ <strong>1. Top Lists:&nbsp;</strong>
64
+ Our team loves putting together lists of all kinds, including
65
+ <a data-page-id="99259" href="/real-money-online-casinos">
66
+ top real money casinos
67
+ </a>
68
+ , top casino bonuses,
69
+ <a data-page-id="99338" href="/free-casinos-no-deposit-south-africa">
70
+ top no deposit bonus casinos
71
+ </a>
72
+ ,
73
+ <a data-page-id="99254" href="/live-dealer-casinos-south-africa">top live dealer casinos</a>
74
+ ,
75
+ <a data-page-id="99363" href="/sports-betting-listings">
76
+ top sportsbooks,&nbsp;
77
+ </a>
78
+ <a data-page-id="98607" href="/low-wagering-casino-bonuses">
79
+ top low wagering bonuses
80
+ </a>
81
+ etc.</p>
82
+ <p>
83
+ <strong>
84
+ 2. Casino and Sportsbook Reviews:&nbsp;
85
+ </strong>
86
+ Every casino and sportsbook we recommend is extensively reviewed by our professional team. We look at everything from games and bonuses available, to issues such as fairness, payouts, and security. Well provide unbiased and
87
+ <a href="/online-casino-reviews">
88
+ objective reviews of the casinos
89
+ </a>
90
+ and sportsbooks listings, to help you make an educated decision before betting your bankroll at the site of any online or
91
+ <a data-page-id="99146" href="/land-based-casino-listings">land based casino
92
+ </a>
93
+ .</p><p><strong>3. Game Reviews:</strong> New games are released to the South African casino landscape every month. Youll find reviews of all these new games, as well as all the popular classics. Learn about the important features of<a data-page-id="98606" href="/slots">&nbsp;new slots
94
+ </a>, real money slots, and table games, such as betting limits, themes, bonus features, free play and
95
+ <a data-page-id="99186" href="/progressive-jackpots">
96
+ progressive jackpots
97
+ </a>.
98
+ Discover exciting and rewarding new titles to spice up your gaming sessions.
99
+ </p>
100
+ <p>
101
+ <strong>4. Reviews on Software Providers:
102
+ </strong> The companies that provide fantastic games at the best SA online casinos are reviewed on this site. Well examine which providers are better than others and let you know why.&nbsp; Well list the games that make up their portfolio and tell you where you can find their titles.
103
+ </p>
104
+ <p>
105
+ <strong>
106
+ 5. Reviews on Payment Methods:
107
+ </strong> Payment methods form the backbone for the secure transfer of funds into and from your
108
+ <a data-page-id="99253" href="/zar-online-casinos-south-africa">
109
+ &nbsp;ZAR-friendly casino accounts
110
+ </a> which is why we only recommend trusted and proven banking methods that are safe, easy and convenient for South Africans to use.
111
+ </p> <p>
112
+ <iframe width="960" height="560" src="https://www.youtube.com/embed/zdzQcsduee8" title="YouTube video player" frameborder="0" allowfullscreen="0">
113
+ </iframe>
114
+ </p>
115
+ <p>
116
+ <strong>
117
+ 6. Guides:&nbsp;
118
+ </strong>
119
+ From
120
+ <a data-page-id="99185" href="/online-casino-gambling">
121
+ beginner guides and how-to-play guides
122
+ </a>
123
+ to more intermediate and advanced strategies and tips, we cover everything players need to know whether they are new or experienced.
124
+ </p>
125
+ <p>
126
+ <strong>
127
+ 7. News:&nbsp;
128
+ </strong>
129
+ We are firm believers that to truly succeed in online gambling, you need to keep abreast of the
130
+ <a href="/blog">
131
+ &nbsp;latest news
132
+ </a>
133
+ and be informed about industry updates. We are proud of our regularly updated news page that tells you about the latest promotions and reports on industry-related developments, both in South Africa and in the greater global industry. Dont miss out on the informative content on everything you wish to know, including much needed data &amp; math to check
134
+ <a data-page-id="98584" href="/blog/chances-you-win-south-african-lottery">
135
+ how likely you are to win the lottery
136
+ </a>
137
+ ?
138
+ </p>
139
+ <p>
140
+ <iframe width="960" height="560" src="https://www.youtube.com/embed/zdzQcsduee8" title="YouTube video player" frameborder="0" allowfullscreen="0">
141
+ </iframe>
142
+ </p>
143
+ `,
144
+ };
145
+ const { container } = render(<Content module={iframeModule} />);
146
+
147
+ expect(container.querySelectorAll('iframe')).toBeTruthy();
148
+ expect(container.querySelectorAll('noscript').length).toEqual(5);
149
+ });
23
150
  });
24
151
  afterEach(() => {
25
152
  cleanup();
@@ -42,7 +42,6 @@ const Content = ({ module, pageContext = null }) => {
42
42
  }
43
43
  return null;
44
44
  };
45
-
46
45
  const template = pageContext?.page?.template;
47
46
 
48
47
  return (
@@ -20,6 +20,12 @@ describe('header component', () => {
20
20
  // Testing image
21
21
  expect(container.querySelector('img')).toBeTruthy();
22
22
  });
23
+
24
+ test('render header', () => {
25
+ const { container } = render(<Header section={headerSection} content="<p>Hello</p>" />);
26
+ expect(container.querySelectorAll('header')).toHaveLength(1);
27
+ expect(container.querySelectorAll('.headerContent')).toHaveLength(1);
28
+ });
23
29
  });
24
30
  afterEach(() => {
25
31
  cleanup();
@@ -1,31 +1,67 @@
1
1
  import React from 'react';
2
- import { render, cleanup, waitFor } from '@testing-library/react';
2
+ import { render, cleanup } from '@testing-library/react';
3
3
  import '@testing-library/jest-dom/extend-expect';
4
4
 
5
5
  import '~tests/helpers/match-media.mock';
6
6
  import { getSingleContentData } from '~tests/factories/modules/content.factory';
7
7
  import Main from '.';
8
+ import { schema, templatesInSchema } from '~tests/factories/modules/schema.factory.js';
8
9
 
9
- const section = {
10
- modules: [
11
- {
12
- name: 'content',
13
- ...getSingleContentData(),
14
- },
15
- ],
10
+ const section = (title) => {
11
+ const data = {
12
+ modules: [
13
+ {
14
+ name: 'content',
15
+ ...getSingleContentData('h2', 1, title),
16
+ },
17
+ ],
18
+ };
19
+
20
+ return data;
16
21
  };
17
22
 
18
23
  const pageObject = { page: { path: 's' } };
19
24
 
20
25
  describe('Main Component', () => {
21
26
  test('render main', async () => {
22
- const { container, getByText } = render(<Main section={section} pageContext={pageObject} />);
27
+ const sectionData = section('main');
28
+ const { container } = render(<Main section={sectionData} pageContext={pageObject} />);
29
+ expect(container).toBeTruthy();
30
+ expect(container.querySelectorAll('main.modulePage')).toHaveLength(1);
31
+ });
32
+ test('render main with author', async () => {
33
+ const sectionData = section('author');
34
+ const pageObjectSecond = { page: { path: 'author', author: {} } };
35
+
36
+ const { container } = render(<Main section={sectionData} pageContext={pageObjectSecond} />);
37
+
38
+ expect(container).toBeTruthy();
39
+ expect(container.querySelectorAll('main.modulePage')).toHaveLength(1);
40
+ });
41
+
42
+ test('render main with sitemap as path', async () => {
43
+ const sectionData = section('sitemap');
44
+
45
+ const pageObjectSecond = {
46
+ page: { path: 'sitemap' },
47
+ templates: templatesInSchema,
48
+ sitemapData: schema,
49
+ };
50
+
51
+ const { container } = render(<Main section={sectionData} pageContext={pageObjectSecond} />);
52
+
23
53
  expect(container).toBeTruthy();
24
54
  expect(container.querySelectorAll('main.modulePage')).toHaveLength(1);
55
+ });
25
56
 
26
- await waitFor(() => {
27
- expect(getByText('Test Content 1')).toBeTruthy();
28
- });
57
+ test('render main with 404 as path ', async () => {
58
+ const sectionData = section('404Sites');
59
+
60
+ const pageObjectSecond = { page: { path: '404', author: {} } };
61
+
62
+ const { container } = render(<Main section={sectionData} pageContext={pageObjectSecond} />);
63
+ expect(container).toBeTruthy();
64
+ expect(container.querySelectorAll('main.modulePage')).toHaveLength(1);
29
65
  });
30
66
  });
31
67
  afterEach(() => {
@@ -52,6 +52,7 @@ describe('Menu Component', () => {
52
52
  mobile: {
53
53
  animation: 'collapse',
54
54
  closeHandler: null,
55
+ stopScrollOnOpen: true,
55
56
  },
56
57
  desktop: {
57
58
  orientation: 'horizontal',
@@ -64,6 +65,32 @@ describe('Menu Component', () => {
64
65
  });
65
66
 
66
67
  test('menu icon', () => {
68
+ const mockFn = jest.fn();
69
+ const { container } = render(
70
+ <NavigationProvider>
71
+ <Menu
72
+ section={menuSection.navigation}
73
+ menu={menuSection.menuList[0]}
74
+ options={{
75
+ mobile: {
76
+ animation: 'collapse',
77
+ closeHandler: mockFn,
78
+ },
79
+ desktop: {
80
+ orientation: 'horizontal',
81
+ },
82
+ }}
83
+ />
84
+ </NavigationProvider>
85
+ );
86
+ expect(container.querySelectorAll('.menuIconContainer')).toHaveLength(1);
87
+ expect(container.querySelectorAll('.menuIcon')).toHaveLength(1);
88
+ fireEvent.click(container.querySelector('.menuIconContainer'));
89
+ fireEvent.keyDown(container.querySelector('.menuIconContainer'));
90
+ expect(mockFn).toHaveBeenCalled();
91
+ });
92
+
93
+ test('test menu with children', () => {
67
94
  const mockFn = jest.fn();
68
95
  const { container } = render(
69
96
  <NavigationProvider>
@@ -5,6 +5,39 @@ import '@testing-library/jest-dom/extend-expect';
5
5
  import '~tests/helpers/match-media.mock';
6
6
  import Module from '.';
7
7
  import { getListContentData, contentTableOne } from '~tests/factories/modules/content.factory';
8
+ import { objectsHolder } from '~tests/factories/modules/modules.factory';
9
+
10
+ const getAnchorList = (number = 1) => {
11
+ function anchor(idNumber) {
12
+ return {
13
+ label: `Game Selection ${idNumber}`,
14
+ slug: `game-selection ${idNumber}`,
15
+ type: `module ${idNumber}`,
16
+ };
17
+ }
18
+
19
+ const arr = [];
20
+ for (let i = 0; i < number; i += 1) {
21
+ arr.push(anchor(i));
22
+ }
23
+
24
+ return arr;
25
+ };
26
+
27
+ const getCaruselData = (number) => {
28
+ function caruselImg(idNumber) {
29
+ return {
30
+ image: `http://imgSrc//${idNumber}`,
31
+ };
32
+ }
33
+
34
+ const arr = [];
35
+ for (let i = 0; i < number; i += 1) {
36
+ arr.push(caruselImg(i));
37
+ }
38
+
39
+ return arr;
40
+ };
8
41
 
9
42
  describe('Modules Component ', () => {
10
43
  test('render with props', async () => {
@@ -30,6 +63,107 @@ describe('Modules Component ', () => {
30
63
  const { container } = render(<Module module={{ name: 'content', ...contentTableOne }} />);
31
64
  expect(container.querySelectorAll('h2')).toHaveLength(0);
32
65
  });
66
+
67
+ test('Swich for All component', () => {
68
+ const arr = [
69
+ 'content',
70
+ 'top_list',
71
+ 'cards',
72
+ 'cards_v2',
73
+ 'pros_and_cons',
74
+ 'accordion',
75
+ 'bonus',
76
+ 'image',
77
+ 'spotlights',
78
+ ];
79
+ arr.forEach((title) => {
80
+ const data = objectsHolder(title);
81
+
82
+ const { container } = render(
83
+ <Module
84
+ module={{
85
+ name: title,
86
+ anchor_label: title,
87
+ ...data,
88
+ }}
89
+ page={{ template: 'default' }}
90
+ />
91
+ );
92
+
93
+ expect(container.querySelector('div')).toBeTruthy();
94
+ });
95
+ });
96
+
97
+ test('Anchor and archive without moduleItem items', () => {
98
+ const arr = ['archive', 'anchor'];
99
+
100
+ arr.forEach((elm) => {
101
+ const { container } = render(
102
+ <Module
103
+ module={{
104
+ name: elm,
105
+ items: [],
106
+ }}
107
+ />
108
+ );
109
+ expect(container.querySelector('div')).toBe(null);
110
+ });
111
+ });
112
+
113
+ test('Anchor and archive with moduleItem', () => {
114
+ const arr = ['archive', 'anchor'];
115
+
116
+ arr.forEach((elm) => {
117
+ const content = getAnchorList(3);
118
+ const { container } = render(
119
+ <Module
120
+ module={{
121
+ name: elm,
122
+ items: content,
123
+ }}
124
+ />
125
+ );
126
+ // console.log('getByText(container)', getByText(container))
127
+ expect(container).toBeTruthy();
128
+ });
129
+ });
130
+
131
+ test('carousel without data', () => {
132
+ const { container } = render(
133
+ <Module
134
+ module={{
135
+ name: 'carousel',
136
+ items: [{ image: null }],
137
+ }}
138
+ />
139
+ );
140
+
141
+ expect(container.querySelector('div')).toBe(null);
142
+ });
143
+
144
+ test('carusel with data', () => {
145
+ const data = getCaruselData(3);
146
+ const { container } = render(
147
+ <Module
148
+ module={{
149
+ name: 'carousel',
150
+ items: data,
151
+ }}
152
+ />
153
+ );
154
+ expect(container).toBeTruthy();
155
+ });
156
+
157
+ test('module name is not in swich', () => {
158
+ const { container } = render(
159
+ <Module
160
+ module={{
161
+ name: 'test',
162
+ }}
163
+ />
164
+ );
165
+ expect(container.querySelector('div')).toBe(null);
166
+ });
33
167
  });
34
168
  afterEach(() => {
35
169
  cleanup();
@@ -1,5 +1,7 @@
1
+ /* eslint-disable no-lone-blocks */
2
+ /* eslint-disable no-unused-expressions */
1
3
  import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
4
+ import { render, cleanup, fireEvent } from '@testing-library/react';
3
5
  import '@testing-library/jest-dom/extend-expect';
4
6
 
5
7
  import OperatorBanner from '.';
@@ -14,6 +16,10 @@ describe('OperatorBanner Component', () => {
14
16
  expect(container.querySelectorAll('.sticky')).toHaveLength(1);
15
17
  expect(getByText('Rizk Casino')).toBeTruthy();
16
18
  expect(getByText('Visit')).toBeTruthy();
19
+ const button = container.querySelector('.closeBtn');
20
+ {
21
+ button && fireEvent.click(button);
22
+ }
17
23
  });
18
24
  test('render component placeholder', () => {
19
25
  const data = getPageData();
@@ -1,60 +1,59 @@
1
1
  .padd {
2
- padding: 0 1.15rem;
3
- border-radius: var(--border-radius);
4
- background-color: white;
5
- margin: 0 0.4rem;
2
+ padding: 0 1.15rem;
3
+ border-radius: var(--border-radius);
4
+ background-color: white;
5
+ margin: 0 0.4rem;
6
+ height: 4.8rem;
7
+ // TODO remove border
8
+ border: 1px solid var(--pagination-with-midpoints-color);
9
+ @include flex-align(center, center);
10
+ @media all and (max-width: 400px) {
11
+ margin: 0 0.1rem;
12
+ padding: 0 0.7rem;
13
+ }
14
+ }
15
+ .pagination {
16
+ margin: 1rem auto;
17
+ @include flex-align(center, center);
18
+
19
+ a,
20
+ span {
21
+ color: var(--color-10);
22
+ display: inline-block;
23
+ font-size: 1.8rem;
24
+ line-height: 4.8rem;
6
25
  height: 4.8rem;
7
- // TODO remove border
8
- border: 1px solid #ccc;
9
- @include flex-align(center, center);
10
- @media all and (max-width: 400px) {
11
- margin: 0 0.1rem;
12
- padding: 0 0.7rem;
13
- }
14
26
  }
15
- .pagination {
16
- margin: 1rem auto;
27
+ a {
28
+ padding: 0 0.4rem;
29
+ }
30
+ .button {
17
31
  @include flex-align(center, center);
18
-
19
- a,
20
- span {
32
+ font-size: 2.5rem;
33
+ @extend .padd;
34
+ color: var(--color-7);
35
+ cursor: not-allowed;
36
+ &.isActive {
21
37
  color: var(--color-10);
22
- display: inline-block;
23
- font-size: 1.8rem;
24
- line-height: 4.8rem;
25
- height: 4.8rem;
26
- }
27
- a {
28
- padding: 0 0.4rem;
29
- }
30
- .button {
31
- @include flex-align(center, center);
32
- font-size: 2.5rem;
33
- @extend .padd;
34
- color: var(--color-7);
35
- cursor: not-allowed;
36
- &.isActive {
37
- color: var(--color-10);
38
- cursor: pointer;
39
- }
38
+ cursor: pointer;
40
39
  }
41
-
42
- .active {
43
- color: var(--secondary-color);
40
+ }
41
+
42
+ .active {
43
+ color: var(--secondary-color);
44
+ }
45
+ li {
46
+ &.showInMobile {
47
+ display: none;
44
48
  }
49
+ }
50
+ @include max(mobile) {
45
51
  li {
46
- &.showInMobile {
47
- display: none;
48
- }
49
- }
50
- @include max(mobile) {
51
- li {
52
- display: none;
53
- &.showInMobile,
54
- &.showInAll {
55
- display: inline-block;
56
- }
52
+ display: none;
53
+ &.showInMobile,
54
+ &.showInAll {
55
+ display: inline-block;
57
56
  }
58
57
  }
59
58
  }
60
-
59
+ }
@@ -132,6 +132,12 @@ function Slider({
132
132
  // Keep slider node reference for multiple carousels in an instance
133
133
  const sliderContentNode = sliderContentRef.current;
134
134
 
135
+ sliderContentNode.style.setProperty('width', style.width);
136
+ sliderContentNode.style.setProperty('transition', style.transition);
137
+ sliderContentNode.style.setProperty('transform', style.transform);
138
+ sliderContentNode.style.setProperty('grid-template-columns', style.gridTemplateColumns);
139
+ sliderContentNode.style.setProperty('gap', style.gridGap);
140
+
135
141
  const mousedown = (e) => {
136
142
  sliderIsActive.current = true;
137
143
  swipeStart(e, updateOnSwipe);
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/no-array-index-key */
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
 
@@ -22,18 +23,20 @@ function Anchor({ module: { items }, headerOffset = 80 }) {
22
23
  };
23
24
 
24
25
  return (
25
- <div className={styles.anchor}>
26
- {items.map((anchor) => (
27
- <a
28
- className={`${styles.link} anchor-carousel-gtm anchor-menu-gtm`}
29
- key={keygen()}
30
- onClick={handleClick}
31
- href={`#${anchor.label && anchorLink(anchor?.label?.toLowerCase().trim())}`}
32
- >
33
- {anchor?.label}
34
- </a>
26
+ <ul className={styles.anchor}>
27
+ {items.map((anchor, index) => (
28
+ <li key={index}>
29
+ <a
30
+ className={`${styles.link} anchor-carousel-gtm anchor-menu-gtm`}
31
+ key={keygen()}
32
+ onClick={handleClick}
33
+ href={`#${anchor.label && anchorLink(anchor?.label?.toLowerCase().trim())}`}
34
+ >
35
+ {anchor?.label}
36
+ </a>
37
+ </li>
35
38
  ))}
36
- </div>
39
+ </ul>
37
40
  );
38
41
  }
39
42
 
@@ -6,15 +6,25 @@ import Slide from '~molecules/carousel/default-slide';
6
6
  import keygen from '~helpers/keygen';
7
7
  import styles from './carousel.module.scss';
8
8
 
9
- const Carousel = ({ module = {}, settings = {}, CustomSlideComponent, gtmClass = '' }) => (
9
+ const Carousel = ({
10
+ page = {},
11
+ module = {},
12
+ settings = {},
13
+ CustomSlideComponent,
14
+ gtmClass = '',
15
+ }) => (
10
16
  <div className={styles.carouselContainer}>
11
17
  <Slider {...settings} gtmClass={gtmClass}>
12
- {module.items.map((item) => (
18
+ {module.items.map((item, index) => (
13
19
  <div key={keygen()} className={styles.carouselItem}>
14
20
  {CustomSlideComponent !== undefined ? (
15
21
  <CustomSlideComponent item={item} gtmClass={gtmClass} />
16
22
  ) : (
17
- <Slide item={item} gtmClass={gtmClass} />
23
+ <Slide
24
+ slideTitle={`${page.title}-carousel-${index + 1}`}
25
+ item={item}
26
+ gtmClass={gtmClass}
27
+ />
18
28
  )}
19
29
  </div>
20
30
  ))}
@@ -23,6 +33,9 @@ const Carousel = ({ module = {}, settings = {}, CustomSlideComponent, gtmClass =
23
33
  );
24
34
 
25
35
  Carousel.propTypes = {
36
+ page: PropTypes.shape({
37
+ title: PropTypes.string,
38
+ }),
26
39
  module: PropTypes.shape({
27
40
  items: PropTypes.arrayOf(
28
41
  PropTypes.shape({