Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Develop #28

Merged
merged 3 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [0.1.22](https://github.com/eea/volto-forests-theme/compare/0.1.21...0.1.22)

- Header better data fetch cleanup [`6baf20d`](https://github.com/eea/volto-forests-theme/commit/6baf20d3f89471aea06efc59737947e5625afc03)

#### [0.1.21](https://github.com/eea/volto-forests-theme/compare/0.1.20...0.1.21)

> 29 November 2021

- Develop [`#27`](https://github.com/eea/volto-forests-theme/pull/27)
- redesign homepage desktop [`#6`](https://github.com/eea/volto-forests-theme/pull/6)
- update view on 1200 [`63e1d5a`](https://github.com/eea/volto-forests-theme/commit/63e1d5af7066437e52436b8f7c59e13c0b59768b)
- complete redesign of homepage [`889b6a2`](https://github.com/eea/volto-forests-theme/commit/889b6a297dea2f388f0f237ab42866e71d82e577)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-forests-theme",
"version": "0.1.21",
"version": "0.1.22",
"description": "@eeacms/volto-forests-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
55 changes: 3 additions & 52 deletions src/customizations/volto/components/theme/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,6 @@ const Header = (props) => {
const [leadCaptionText, setLeadCaptionText] = React.useState('');
const [navigationItems, setNavigationItems] = React.useState('');

// console.log('parentImg', props.parentImg);
// const getParentData = (url) => {
// axios
// .get(url, {
// headers: {
// accept: 'application/json',
// },
// })
// .then((response) => {
// const parentImage =
// response.data && response.data.image && response.data.image.download
// ? response.data.image.download
// : '';

// const parentLeadCaption =
// response.data &&
// response.data.lead_image_caption &&
// response.data.lead_image_caption.data
// ? response.data.lead_image_caption.data
// : '';

// const parentData =
// response.data && props.navItems && response.data['@id']
// ? getNavigationByParent(
// props.navItems,
// getBasePath(response.data['@id']),
// )
// : '';
// if (inheritLeadingData) {
// //setInheritedImage(props.parentImg);
// //setLeadCaptionText(parentLeadCaption);
// }
// // if (leadNavigation) {
// // setNavigationItems(parentData.items);
// // }
// })
// .catch((error) => {
// return error;
// });
// };
React.useEffect(() => {
if (leadNavigation || inheritLeadingData) {
if (!props.parentItems || props.parentItems.length === 0) {
Expand All @@ -86,6 +46,9 @@ const Header = (props) => {
setInheritedImage(props.parentImg.download);
if (props.leadCaption) setLeadCaptionText(props.leadCaption);
}
if (!inheritLeadingData) {
setLeadCaptionText(leadImageCaption.data);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
Expand All @@ -103,18 +66,6 @@ const Header = (props) => {
}
}, [props.actualPathName, props.frontPageSlides]);

React.useEffect(() => {
if (inheritLeadingData || leadNavigation) {
//const parentUrl = parentData['@id'];
// getParentData(parentUrl);

if (!inheritLeadingData) {
setLeadCaptionText(leadImageCaption.data);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.extraData, props.navItems]);

const defaultHeaderImage = props.defaultHeaderImage;
let headerImageUrl = defaultHeaderImage?.image || defaultHeaderImage;
const pathName = props.pathname;
Expand Down