@eeacms/volto-clms-theme 1.1.21 → 1.1.22

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.
package/CHANGELOG.md CHANGED
@@ -4,11 +4,14 @@ 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.1.21](https://github.com/eea/volto-clms-theme/compare/1.1.20...1.1.21) - 5 July 2023
7
+ ### [1.1.22](https://github.com/eea/volto-clms-theme/compare/1.1.21...1.1.22) - 10 July 2023
8
8
 
9
9
  #### :hammer_and_wrench: Others
10
10
 
11
- - home products cards height control [ionlizarazu - [`b37d08b`](https://github.com/eea/volto-clms-theme/commit/b37d08bae7dff7f341e5a3c9f064837273f5b74d)]
11
+ - unneeded condition [ionlizarazu - [`da81a9c`](https://github.com/eea/volto-clms-theme/commit/da81a9c622d27b4e2706e1fd889e08070a5d3f25)]
12
+ - activeIndex FAQs block [ionlizarazu - [`b550819`](https://github.com/eea/volto-clms-theme/commit/b5508199ded2aa61b1c8f52da7fd49cb6cad59b1)]
13
+ ### [1.1.21](https://github.com/eea/volto-clms-theme/compare/1.1.20...1.1.21) - 5 July 2023
14
+
12
15
  ### [1.1.20](https://github.com/eea/volto-clms-theme/compare/1.1.19...1.1.20) - 5 July 2023
13
16
 
14
17
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
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",
@@ -45,10 +45,21 @@ const CclFAQBlockView = (props) => {
45
45
  )
46
46
  : [],
47
47
  );
48
- const [activeIndex, setActiveIndex] = useState([0]);
48
+ const [activeIndex, setActiveIndex] = useState([]);
49
49
  React.useEffect(() => {
50
50
  dispatch(getContextNavigation(path.replace('/edit', '')));
51
51
  }, [path, dispatch]);
52
+ React.useEffect(() => {
53
+ let indexes = [];
54
+ // eslint-disable-next-line no-unused-expressions
55
+ contextNavigation?.[cn_key]?.data?.items.forEach((i) => {
56
+ if (i.items.length > 0) {
57
+ indexes.push(i.items[0].normalized_id);
58
+ }
59
+ });
60
+ setActiveIndex(indexes);
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
62
+ }, [contextNavigation?.[cn_key]?.data?.items]);
52
63
 
53
64
  const titleIcons = config.blocks?.blocksConfig?.accordion?.titleIcons;
54
65
 
@@ -80,10 +91,12 @@ const CclFAQBlockView = (props) => {
80
91
  <Accordion fluid styled key={item_key}>
81
92
  <Accordion.Title
82
93
  as={'h2'}
83
- onClick={() => handleClick({ index: item_key })}
94
+ onClick={() =>
95
+ handleClick({ index: item.normalized_id })
96
+ }
84
97
  className={'accordion-title align-arrow-right'}
85
98
  >
86
- {activeIndex.includes(item_key) ? (
99
+ {activeIndex.includes(item.normalized_id) ? (
87
100
  <Icon name={titleIcons.opened.rightPosition} />
88
101
  ) : (
89
102
  <Icon name={titleIcons.closed.rightPosition} />
@@ -103,7 +116,7 @@ const CclFAQBlockView = (props) => {
103
116
  <span>{item.title}</span>
104
117
  </Accordion.Title>
105
118
  <Accordion.Content
106
- active={activeIndex.includes(item_key)}
119
+ active={activeIndex.includes(item.normalized_id)}
107
120
  >
108
121
  <AnimateHeight
109
122
  animateOpacity