@eeacms/volto-clms-theme 1.0.21 → 1.0.25

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 (44) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/package.json +4 -3
  3. package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.jsx +2 -2
  4. package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockView.jsx +1 -1
  5. package/src/components/Blocks/CclHomeBgImageBlock/CclWhiteBgView.jsx +1 -1
  6. package/src/components/Blocks/CclHomeProductsBlock/CclHomeProductsBlockEdit.jsx +4 -1
  7. package/src/components/Blocks/CclHomeProductsBlock/CclHomeProductsBlockView.jsx +7 -2
  8. package/src/components/Blocks/CclHomeProductsBlock/HomeProductsSchema.js +5 -1
  9. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockView.jsx +4 -4
  10. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuEdit.jsx +5 -2
  11. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuView.jsx +4 -4
  12. package/src/components/Blocks/CclTechnicalLibrariesList/CclTechnicalLibrariesListEdit.jsx +63 -0
  13. package/src/components/Blocks/CclTechnicalLibrariesList/CclTechnicalLibrariesListView.jsx +43 -0
  14. package/src/components/Blocks/CclTechnicalLibrariesList/TechnicalLibrariesListSchema.js +17 -0
  15. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclTabsView.jsx +2 -1
  16. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +141 -0
  17. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/index.js +2 -1
  18. package/src/components/Blocks/customBlocks.js +26 -0
  19. package/src/components/CLMSEventView/CLMSEventView.jsx +14 -8
  20. package/src/components/CLMSMeetingView/CLMSMeetingSubscribersView.jsx +3 -3
  21. package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +1 -1
  22. package/src/components/CLMSMeetingView/meetingstyles.less +16 -0
  23. package/src/components/CLMSNewsItemView/CLMSNewsItemView.jsx +14 -8
  24. package/src/components/CclCard/CclCard.jsx +18 -4
  25. package/src/components/CclCard/cards.less +16 -0
  26. package/src/components/CclDownloadTable/CclDownloadTable.jsx +1 -1
  27. package/src/components/CclModal/modal.less +1 -0
  28. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +2 -2
  29. package/src/customizations/volto/components/theme/Footer/Footer.jsx +16 -12
  30. package/src/customizations/volto/components/theme/Header/Header.jsx +4 -3
  31. package/src/customizations/volto/components/theme/Logo/Logo.jsx +1 -1
  32. package/src/customizations/volto/components/theme/Navigation/ContextNavigation.jsx +2 -2
  33. package/src/customizations/volto/components/theme/Navigation/Navigation.jsx +1 -1
  34. package/{src/customizations/volto/components/theme/Breadcrumbs/breadcrumbs.less → theme/clms/css/breadcrumbs.css} +0 -0
  35. package/theme/clms/css/carousel.css +6 -6
  36. package/theme/clms/css/ccl.less +1 -1
  37. package/theme/clms/css/faq.less +55 -0
  38. package/{src/customizations/volto/components/theme/Footer/footer.less → theme/clms/css/footer.css} +43 -42
  39. package/{src/customizations/volto/components/theme/Header/header.less → theme/clms/css/header.css} +13 -5
  40. package/theme/clms/css/home.css +93 -37
  41. package/theme/clms/css/maps.css +32 -1
  42. package/theme/clms/css/maps.less +32 -1
  43. package/theme/clms/css/{styles.css → styles.less} +93 -120
  44. package/src/components/CLMSMeetingView/meetingstyles.css +0 -14
package/CHANGELOG.md CHANGED
@@ -4,8 +4,52 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.0.25](https://github.com/eea/volto-clms-theme/compare/1.0.24...1.0.25)
8
+
9
+ - Fixing feedback problems [`#80`](https://github.com/eea/volto-clms-theme/pull/80)
10
+ - empty libraries message [`134ee68`](https://github.com/eea/volto-clms-theme/commit/134ee687a1de7d31d4a62795324a9738e874e605)
11
+ - class to className [`e3bccef`](https://github.com/eea/volto-clms-theme/commit/e3bccefc307424e6508dd4280bb001b45313e8d4)
12
+ - some fixes [`02eddc4`](https://github.com/eea/volto-clms-theme/commit/02eddc4b359359d07e62a5317aaffa61a7a65555)
13
+ - carrousel and some paginations left [`cd0c86e`](https://github.com/eea/volto-clms-theme/commit/cd0c86e1b40c63fd258d5a54415b41c4dd4c4d40)
14
+ - some frontend fixes after eugenija feedback [`7ca4d30`](https://github.com/eea/volto-clms-theme/commit/7ca4d30a7c203a5aaf52b35f3a624d47327a08aa)
15
+
16
+ #### [1.0.24](https://github.com/eea/volto-clms-theme/compare/1.0.23...1.0.24)
17
+
18
+ > 16 September 2021
19
+
20
+ - Upgrade volto-tabs-block version and CclCard fix [`#79`](https://github.com/eea/volto-clms-theme/pull/79)
21
+ - volto-tabs-block upgrade version 1.2.7 [`4f4fd93`](https://github.com/eea/volto-clms-theme/commit/4f4fd931065bd86b368cc174620f8fcf7095a49c)
22
+ - card file field condition to avoid conflicts with old versions [`957bc0a`](https://github.com/eea/volto-clms-theme/commit/957bc0ae531730fea854c31854004b17b883c9f9)
23
+
24
+ #### [1.0.23](https://github.com/eea/volto-clms-theme/compare/1.0.22...1.0.23)
25
+
26
+ > 15 September 2021
27
+
28
+ - Develop [`#78`](https://github.com/eea/volto-clms-theme/pull/78)
29
+ - move css to less [`f1c3e5c`](https://github.com/eea/volto-clms-theme/commit/f1c3e5c3c976d78b0e9fcc9286d12cb25ba922c0)
30
+ - move customizated components additional less out to theme folder [`07099a6`](https://github.com/eea/volto-clms-theme/commit/07099a63d059b88ca5d0cdedc99e2e8299d6dc48)
31
+
32
+ #### [1.0.22](https://github.com/eea/volto-clms-theme/compare/1.0.21...1.0.22)
33
+
34
+ > 15 September 2021
35
+
36
+ - Develop [`#77`](https://github.com/eea/volto-clms-theme/pull/77)
37
+ - Technical library [`#76`](https://github.com/eea/volto-clms-theme/pull/76)
38
+ - Bugs n improvements [`#75`](https://github.com/eea/volto-clms-theme/pull/75)
39
+ - volto-arcgis-block version [`5a8d7a5`](https://github.com/eea/volto-clms-theme/commit/5a8d7a54193d34e5c2a981853843c848564b5024)
40
+ - mime type package [`de14cc1`](https://github.com/eea/volto-clms-theme/commit/de14cc14ca0fb0f4d2afc104495a8f768e863221)
41
+ - technical libraries new block for product [`6d8acd2`](https://github.com/eea/volto-clms-theme/commit/6d8acd209d275465a7c7a35bd691f8ce1652122e)
42
+ - Home [`65f3f48`](https://github.com/eea/volto-clms-theme/commit/65f3f48a16a856920af05933c94a16b2191e3438)
43
+ - Header and footer [`a7ca309`](https://github.com/eea/volto-clms-theme/commit/a7ca3096766d8a7442c376b5ea43854f58d87073)
44
+ - Improvements [`7c0c5b8`](https://github.com/eea/volto-clms-theme/commit/7c0c5b8ea894fdd92d1c1d95c80e85150577c59b)
45
+ - accordion icon min width [`6fa4f09`](https://github.com/eea/volto-clms-theme/commit/6fa4f09f52af8cdb88dc7147ba2b4fe844d32259)
46
+ - meeting view changes with css and faq tabs custom block [`3ed9565`](https://github.com/eea/volto-clms-theme/commit/3ed95651bd0c3a2f96b76ed7e23c32cb6e37289d)
47
+
7
48
  #### [1.0.21](https://github.com/eea/volto-clms-theme/compare/1.0.20...1.0.21)
8
49
 
50
+ > 10 September 2021
51
+
52
+ - Meeting registration and volto-arcgis-block update [`#74`](https://github.com/eea/volto-clms-theme/pull/74)
9
53
  - Eeameeting views [`#73`](https://github.com/eea/volto-clms-theme/pull/73)
10
54
  - update volto-arcgis-block version [`228d73f`](https://github.com/eea/volto-clms-theme/commit/228d73f7e35f672333e0ea29312c47fdeef8e323)
11
55
  - unify code [`63ae210`](https://github.com/eea/volto-clms-theme/commit/63ae2104b6d489c691cd81789a41ab298f99d618)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.21",
3
+ "version": "1.0.25",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -29,12 +29,12 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "volto-dropdownmenu": "2.2.7",
32
- "@eeacms/volto-arcgis-block": "0.1.2",
32
+ "@eeacms/volto-arcgis-block": "0.1.3",
33
33
  "@fortawesome/fontawesome-svg-core": "1.2.35",
34
34
  "@fortawesome/free-solid-svg-icons": "5.15.3",
35
35
  "@fortawesome/free-regular-svg-icons": "5.15.3",
36
36
  "@fortawesome/react-fontawesome": "0.1.14",
37
- "@eeacms/volto-tabs-block": "1.2.3",
37
+ "@eeacms/volto-tabs-block": "1.2.7",
38
38
  "react-slick": "0.28.1",
39
39
  "slick-carousel": "1.8.1",
40
40
  "@eeacms/volto-accordion-block": "^3.0.0",
@@ -42,6 +42,7 @@
42
42
  "@eeacms/volto-metadata-block": "^2.1.0",
43
43
  "volto-slate": "2.6.2",
44
44
  "react-svg": "14.0.4",
45
+ "react-native-mime-types": "2.3.0",
45
46
  "@eeacms/volto-resize-helper": "0.2.1"
46
47
  },
47
48
  "prettier": {
@@ -7,7 +7,7 @@ const CclButtonBlockView = (props) => {
7
7
  return (
8
8
  <CclButton
9
9
  url={
10
- data.download && data?.href?.[0]?.['@type'] === 'File'
10
+ data?.download && data?.href?.[0]?.['@type'] === 'File'
11
11
  ? data?.href?.[0]?.['@id'] + '/@@download/file'
12
12
  : data?.href?.[0]?.['@id']
13
13
  }
@@ -15,7 +15,7 @@ const CclButtonBlockView = (props) => {
15
15
  download={data?.download || data?.href?.[0]?.['@type'] === 'File'}
16
16
  target={
17
17
  data.target ||
18
- (data.download && data.href[0]['@type'] === 'File' && '_blank')
18
+ (data?.download && data.href[0]['@type'] === 'File' && '_blank')
19
19
  }
20
20
  mode={data.style}
21
21
  >
@@ -17,7 +17,7 @@ const CclCardContainerBlockView = (props) => {
17
17
  } else if (data.cardOrigin === 'selection') {
18
18
  path = data.containerSelection ? data.containerSelection[0]['@id'] : '';
19
19
  } else if ((data.cardOrigin = 'custom')) {
20
- cards = data.customCards.blocks_layout.items.map(
20
+ cards = data?.customCards?.blocks_layout?.items.map(
21
21
  (uid) => data.customCards.blocks[uid],
22
22
  );
23
23
  }
@@ -7,7 +7,7 @@ const CclWhiteBgView = (props) => {
7
7
 
8
8
  return (
9
9
  <div
10
- className="ccl-banner-top-container"
10
+ className="home-map-container"
11
11
  style={{
12
12
  backgroundImage:
13
13
  `url(${data?.image?.url}/@@images/image)` ||
@@ -70,7 +70,10 @@ const CclHomeProductsBlockEdit = (props) => {
70
70
  {panel.productIcon === 'iconless' ? (
71
71
  <h3>{panel.title}</h3>
72
72
  ) : (
73
- <div className="home-product-title">{panel.title}</div>
73
+ <>
74
+ <div className="home-product-title">{panel.title}</div>
75
+ <div class="home-product-description">{panel.description}</div>
76
+ </>
74
77
  )}
75
78
  </div>
76
79
  ))}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  const CclHomeProductsBlockView = (props) => {
4
4
  const { data } = props;
5
- let products = data.products.blocks_layout.items.map(
5
+ let products = data?.products?.blocks_layout?.items.map(
6
6
  (uid) => data.products.blocks[uid],
7
7
  );
8
8
  return (
@@ -20,7 +20,12 @@ const CclHomeProductsBlockView = (props) => {
20
20
  {product.productIcon === 'iconless' ? (
21
21
  <h3>{product.title}</h3>
22
22
  ) : (
23
- <div className="home-product-title">{product.title}</div>
23
+ <>
24
+ <div className="home-product-title">{product.title}</div>
25
+ <div className="home-product-description">
26
+ {product.description}
27
+ </div>
28
+ </>
24
29
  )}
25
30
  </div>
26
31
  ))}
@@ -28,7 +28,7 @@ export const ProductSchema = () => ({
28
28
  {
29
29
  id: 'default',
30
30
  title: 'Default',
31
- fields: ['title', 'productIcon', 'linkSelector'],
31
+ fields: ['title', 'description', 'productIcon', 'linkSelector'],
32
32
  },
33
33
  ],
34
34
  properties: {
@@ -36,6 +36,10 @@ export const ProductSchema = () => ({
36
36
  title: 'Title',
37
37
  type: 'string',
38
38
  },
39
+ description: {
40
+ title: 'Description',
41
+ type: 'string',
42
+ },
39
43
  productIcon: {
40
44
  title: 'Product icon',
41
45
  choices: [
@@ -37,7 +37,7 @@ const CclHomeUsersBlockView = (props) => {
37
37
  ],
38
38
  };
39
39
  const { data } = props;
40
- let cards = data.customCards.blocks_layout.items.map(
40
+ let cards = data?.customCards?.blocks_layout?.items.map(
41
41
  (uid) => data.customCards.blocks[uid],
42
42
  );
43
43
 
@@ -70,10 +70,10 @@ const CclHomeUsersBlockView = (props) => {
70
70
  </div>
71
71
  ))}
72
72
  </Slider>
73
+ <a className="ccl-button ccl-button--default" href="./use-cases.html">
74
+ All use cases
75
+ </a>
73
76
  </div>
74
- <a className="ccl-button ccl-button--default" href="./use-cases.html">
75
- All use cases
76
- </a>
77
77
  </div>
78
78
  );
79
79
  };
@@ -46,7 +46,10 @@ const CclProductLeftMenuEdit = (props) => {
46
46
  <>
47
47
  <nav className="left-menu-detail">
48
48
  <div className="menu-detail-image">
49
- <img src={metadata.image.download} alt={metadata.image.filename} />
49
+ <img
50
+ src={metadata?.image?.download}
51
+ alt={metadata?.image?.filename}
52
+ />
50
53
  </div>
51
54
  {panels.map(([uid, panel], index) => (
52
55
  <div
@@ -68,7 +71,7 @@ const CclProductLeftMenuEdit = (props) => {
68
71
  <CclButton
69
72
  url="#"
70
73
  disabled={data.buttons?.blocks[uid].disabled}
71
- download={data.buttons?.blocks[uid].download}
74
+ download={data.buttons?.blocks[uid]?.download}
72
75
  mode={data.buttons?.blocks[uid].style}
73
76
  >
74
77
  {data.buttons?.blocks[uid].title || 'Text example...'}
@@ -4,20 +4,20 @@ import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
4
4
 
5
5
  const CclProductLeftMenuView = (props) => {
6
6
  const { data, metadata } = props;
7
- let buttons = data.buttons.blocks_layout.items.map(
7
+ let buttons = data?.buttons?.blocks_layout?.items.map(
8
8
  (uid) => data.buttons.blocks[uid],
9
9
  );
10
10
 
11
11
  return (
12
12
  <nav className="left-menu-detail">
13
13
  <div className="menu-detail-image">
14
- <img src={metadata.image.download} alt={metadata.image.filename} />
14
+ <img src={metadata?.image?.download} alt={metadata?.image?.filename} />
15
15
  </div>
16
16
  {buttons.map((button, index) => (
17
17
  <div key={index} className={'menu-detail-button'}>
18
18
  <CclButton
19
19
  url={
20
- button.download && button?.href?.[0]?.['@type'] === 'File'
20
+ button?.download && button?.href?.[0]?.['@type'] === 'File'
21
21
  ? button?.href?.[0]?.['@id'] + '/@@download/file'
22
22
  : button?.href?.[0]?.['@id']
23
23
  }
@@ -27,7 +27,7 @@ const CclProductLeftMenuView = (props) => {
27
27
  }
28
28
  target={
29
29
  button.target ||
30
- (button.download &&
30
+ (button?.download &&
31
31
  button.href[0]['@type'] === 'File' &&
32
32
  '_blank')
33
33
  }
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { TechnicalLibrariesListSchema } from './TechnicalLibrariesListSchema';
3
+ import { SidebarPortal } from '@plone/volto/components';
4
+ import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
5
+ import { useSelector, useDispatch } from 'react-redux';
6
+ import { searchContent } from '@plone/volto/actions';
7
+ import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
8
+
9
+ const CclTechnicalLibrariesListEdit = (props) => {
10
+ const {
11
+ block,
12
+ data,
13
+ onChangeBlock,
14
+ selected,
15
+ id,
16
+ properties,
17
+ metadata,
18
+ } = props;
19
+ const dispatch = useDispatch();
20
+ const searchSubrequests = useSelector((state) => state.search.subrequests);
21
+ const path = metadata ? metadata['@id'] : properties['@id'];
22
+ let libraries = searchSubrequests?.[props.id]?.items || [];
23
+ React.useEffect(() => {
24
+ dispatch(
25
+ searchContent(
26
+ path,
27
+ {
28
+ fullobjects: 1,
29
+ portal_type: 'TechnicalLibrary',
30
+ path: '/',
31
+ associated_products: metadata['id'],
32
+ },
33
+ id,
34
+ ),
35
+ );
36
+ }, [path, data, id, metadata, dispatch]);
37
+
38
+ return (
39
+ <>
40
+ <div className="technical-libraries">
41
+ <h2>Technical Libraries</h2>
42
+ {libraries.map((item, index) => (
43
+ <CclCard key={index} type="doc" card={item} />
44
+ ))}
45
+ </div>
46
+ <SidebarPortal selected={selected}>
47
+ <InlineForm
48
+ schema={TechnicalLibrariesListSchema()}
49
+ title="TechnicalLibraries List block"
50
+ onChangeField={(id, value) => {
51
+ onChangeBlock(block, {
52
+ ...data,
53
+ [id]: value,
54
+ });
55
+ }}
56
+ formData={data}
57
+ />
58
+ </SidebarPortal>
59
+ </>
60
+ );
61
+ };
62
+
63
+ export default CclTechnicalLibrariesListEdit;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { useSelector, useDispatch } from 'react-redux';
3
+ import { searchContent } from '@plone/volto/actions';
4
+ import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
5
+
6
+ const CclTechnicalLibrariesListView = (props) => {
7
+ const { data, id, properties, metadata } = props;
8
+ const dispatch = useDispatch();
9
+ const searchSubrequests = useSelector((state) => state.search.subrequests);
10
+ const path = metadata ? metadata['@id'] : properties['@id'];
11
+ let libraries = searchSubrequests?.[props.id]?.items || [];
12
+
13
+ React.useEffect(() => {
14
+ dispatch(
15
+ searchContent(
16
+ path,
17
+ {
18
+ fullobjects: 1,
19
+ portal_type: 'TechnicalLibrary',
20
+ path: '/',
21
+ associated_products: metadata['id'],
22
+ },
23
+ id,
24
+ ),
25
+ );
26
+ }, [path, data, id, metadata, dispatch]);
27
+
28
+ return (
29
+ <>
30
+ <div className="technical-libraries">
31
+ {libraries.length > 0 ? (
32
+ libraries.map((item, index) => (
33
+ <CclCard key={index} type="doc" card={item} />
34
+ ))
35
+ ) : (
36
+ <p>There are no technical libraries for this product.</p>
37
+ )}
38
+ </div>
39
+ </>
40
+ );
41
+ };
42
+
43
+ export default CclTechnicalLibrariesListView;
@@ -0,0 +1,17 @@
1
+ export const TechnicalLibrariesListSchema = () => ({
2
+ title: 'TechnicalLibraries List block',
3
+ fieldsets: [
4
+ {
5
+ id: 'default',
6
+ title: 'Default',
7
+ fields: ['title'],
8
+ },
9
+ ],
10
+ properties: {
11
+ title: {
12
+ title: 'Title',
13
+ type: 'string',
14
+ },
15
+ },
16
+ required: [],
17
+ });
@@ -99,7 +99,8 @@ const CclTabsView = (props) => {
99
99
  aria-controls={title || defaultTitle}
100
100
  aria-selected={tab === activeTab}
101
101
  active={(tab === activeTab).toString()}
102
- className={cx('tab', tab === activeTab && 'tab-selected')}
102
+ /* classname hontan estiloa aldatu behar da aukeratutako tab-a urdin ikusteko */
103
+ className={cx('tab', tab !== activeTab && 'tab-selected')}
103
104
  onClick={() => {
104
105
  if (activeTab !== tab) {
105
106
  setActiveTab(tab);
@@ -0,0 +1,141 @@
1
+ import React from 'react';
2
+ import { connect } from 'react-redux';
3
+ import { compose } from 'redux';
4
+ import { withRouter } from 'react-router';
5
+ import { RenderBlocks } from '@plone/volto/components';
6
+ import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
7
+ import './fontawesome';
8
+ import cx from 'classnames';
9
+
10
+ const CclVerticalFaqTabsView = (props) => {
11
+ const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
12
+ const {
13
+ metadata = {},
14
+ data = {},
15
+ tabsList = [],
16
+ activeTabIndex = 0,
17
+ hashlink = {},
18
+ setActiveTab = () => {},
19
+ } = props;
20
+
21
+ React.useEffect(() => {
22
+ const urlHash = props.location.hash.substring(1) || '';
23
+ if (
24
+ hashlink.counter > 0 ||
25
+ (hashlink.counter === 0 && urlHash && !hashlinkOnMount)
26
+ ) {
27
+ const id = hashlink.hash || urlHash || '';
28
+ const index = tabsList.indexOf(id);
29
+ const parentId = data.id || props.id;
30
+ const parent = document.getElementById(parentId);
31
+ const headerWrapper = document.querySelector('.header-wrapper');
32
+ const offsetHeight = headerWrapper?.offsetHeight || 0;
33
+ if (id !== parentId && index > -1 && parent) {
34
+ if (activeTabIndex !== index) {
35
+ setActiveTab(id);
36
+ }
37
+ props.scrollToTarget(parent, offsetHeight);
38
+ } else if (id === parentId && parent) {
39
+ props.scrollToTarget(parent, offsetHeight);
40
+ }
41
+ }
42
+ if (!hashlinkOnMount) {
43
+ setHashlinkOnMount(true);
44
+ }
45
+ }, [
46
+ activeTabIndex,
47
+ data.id,
48
+ hashlink.counter,
49
+ hashlink.hash,
50
+ hashlinkOnMount,
51
+ props,
52
+ setActiveTab,
53
+ tabsList,
54
+ ]);
55
+
56
+ const PanelsComponent = () => {
57
+ const { activeTab = null, tabs = {} } = props;
58
+ return (
59
+ <div className="right-content cont-w-75">
60
+ {tabsList.map((tab, index) => {
61
+ return (
62
+ <div
63
+ key={index}
64
+ className={cx('panel', tab === activeTab && 'panel-selected')}
65
+ role="tabpanel"
66
+ aria-hidden="false"
67
+ >
68
+ <RenderBlocks
69
+ {...props}
70
+ metadata={metadata}
71
+ content={tabs[tab]}
72
+ />
73
+ </div>
74
+ );
75
+ })}
76
+ </div>
77
+ );
78
+ };
79
+ const TabsComponent = () => {
80
+ return (
81
+ <div className="left-content cont-w-25">
82
+ <nav className="left-menu">
83
+ {tabsList.map((tab, index) => {
84
+ const {
85
+ activeTab = null,
86
+ tabs = {},
87
+ setActiveTab = () => {},
88
+ } = props;
89
+ const title = tabs[tab].title;
90
+ const tabIndex = index + 1;
91
+ const defaultTitle = `Tab ${tabIndex}`;
92
+ return (
93
+ <div
94
+ key={index}
95
+ id={tabIndex}
96
+ className={cx('card', tab === activeTab && 'active')}
97
+ >
98
+ <a
99
+ href={'#' + tabIndex}
100
+ className="collapsed"
101
+ onClick={(e) => {
102
+ e.preventDefault();
103
+ if (activeTab !== tab) {
104
+ setActiveTab(tab);
105
+ }
106
+ }}
107
+ onKeyDown={() => {
108
+ if (activeTab !== tab) {
109
+ setActiveTab(tab);
110
+ }
111
+ }}
112
+ >
113
+ {title || defaultTitle}
114
+ </a>
115
+ </div>
116
+ );
117
+ })}
118
+ </nav>
119
+ </div>
120
+ );
121
+ };
122
+
123
+ return (
124
+ <div
125
+ id="faq-listing"
126
+ className="ccl-container ccl-container-flex tab-container"
127
+ >
128
+ <TabsComponent />
129
+ <PanelsComponent />
130
+ </div>
131
+ );
132
+ };
133
+
134
+ export default compose(
135
+ connect((state) => {
136
+ return {
137
+ hashlink: state.hashlink,
138
+ };
139
+ }),
140
+ withScrollToTarget,
141
+ )(withRouter(CclVerticalFaqTabsView));