Skip to content

Commit

Permalink
Merge pull request #29 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rexalex authored Mar 24, 2023
2 parents 6bc43b0 + b702664 commit 8dff155
Show file tree
Hide file tree
Showing 20 changed files with 581 additions and 208 deletions.
84 changes: 14 additions & 70 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Release](https://img.shields.io/github/v/release/eea/advisory-board-frontend?sort=semver)](https://github.com/eea/advisory-board-frontend/releases)
[![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto%2Fadvisory-board-frontend%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto/job/advisory-board-frontend/job/master/lastBuild/display/redirect)
[![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto%2Fadvisory-board-frontend%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto/job/advisory-board-frontend/job/develop/lastBuild/display/redirect)
[![Release pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto%2Fadvisory-board-frontend%2F0.18.0&build=last&subject=release%20v0.18.0%20pipeline)](https://ci.eionet.europa.eu/view/Github/job/volto/job/advisory-board-frontend/job/0.18.0/lastBuild/display/redirect/)
[![Release pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto%2Fadvisory-board-frontend%2F0.19.0&build=last&subject=release%20v0.19.0%20pipeline)](https://ci.eionet.europa.eu/view/Github/job/volto/job/advisory-board-frontend/job/0.19.0/lastBuild/display/redirect/)


## Documentation
Expand Down
18 changes: 17 additions & 1 deletion mrs.developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,21 @@
"branch": "develop",
"develop": false,
"path": "src"
},
"volto-hero-block": {
"url": "[email protected]:eea/volto-hero-block.git",
"https": "https://github.com/eea/volto-hero-block.git",
"package": "@eeacms/volto-hero-block",
"branch": "develop",
"develop": false,
"path": "src"
},
"volto-eea-website-theme": {
"url": "[email protected]:eea/volto-eea-website-theme.git",
"https": "https://github.com/eea/volto-eea-website-theme.git",
"package": "@eeacms/volto-eea-website-theme",
"branch": "develop",
"develop": false,
"path": "src"
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "advisory-board-frontend",
"description": "A Volto-powered Plone frontend",
"license": "MIT",
"version": "0.18.0",
"version": "0.19.0",
"scripts": {
"start": "razzle start",
"postinstall": "make omelette && make patches",
Expand Down
14 changes: 14 additions & 0 deletions src/components/manage/Blocks/Hero/Edit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { BodyClass } from '@plone/volto/helpers';
import HeroEdit from '@eeacms/volto-hero-block/components/Blocks/Hero/Edit';

const Edit = (props) => {
return (
<React.Fragment>
<BodyClass className="with-hero-block" />
<HeroEdit {...props} />
</React.Fragment>
);
};

export default Edit;
30 changes: 30 additions & 0 deletions src/components/manage/Blocks/Hero/View.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { Portal } from 'react-portal';
import { BodyClass } from '@plone/volto/helpers';
import HeroView from '@eeacms/volto-hero-block/components/Blocks/Hero/View';

function IsomorphicPortal({ children }) {
const [isClient, setIsClient] = React.useState();
React.useEffect(() => setIsClient(true), []);

return isClient ? (
<Portal node={document.getElementById('page-header')}>{children}</Portal>
) : (
children
);
}

const View = (props) => {
return (
<React.Fragment>
<BodyClass className="with-hero-block" />
<IsomorphicPortal>
<div className="ui container hero-block-container">
<HeroView {...props} />
</div>
</IsomorphicPortal>
</React.Fragment>
);
};

export default View;
14 changes: 14 additions & 0 deletions src/components/manage/Blocks/Hero/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import HeroEdit from './Edit';
import HeroView from './View';

export default (config) => {
if (config.blocks.blocksConfig.hero) {
config.blocks.blocksConfig.hero = {
...config.blocks.blocksConfig.hero,
edit: HeroEdit,
view: HeroView,
};
}

return config;
};
14 changes: 14 additions & 0 deletions src/components/manage/Blocks/Title/Edit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { BodyClass } from '@plone/volto/helpers';
import TitleEdit from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title/Edit';

const Edit = (props) => {
return (
<React.Fragment>
<BodyClass className="with-title-block" />
<TitleEdit {...props} />
</React.Fragment>
);
};

export default Edit;
14 changes: 14 additions & 0 deletions src/components/manage/Blocks/Title/View.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { BodyClass } from '@plone/volto/helpers';
import TitleView from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title/View';

const View = (props) => {
return (
<React.Fragment>
<BodyClass className="with-title-block" />
<TitleView {...props} />
</React.Fragment>
);
};

export default View;
14 changes: 14 additions & 0 deletions src/components/manage/Blocks/Title/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import TitleEdit from './Edit';
import TitleView from './View';

export default (config) => {
if (config.blocks.blocksConfig.title) {
config.blocks.blocksConfig.title = {
...config.blocks.blocksConfig.title,
edit: TitleEdit,
view: TitleView,
};
}

return config;
};
9 changes: 9 additions & 0 deletions src/components/manage/Blocks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import installHeroBlock from './Hero';
import installTitleBlock from './Title';

export default function applyConfig(config) {
return [installHeroBlock, installTitleBlock].reduce(
(acc, apply) => apply(acc),
config,
);
}
Binary file removed src/components/theme/NewsletterForm/Logo.png
Binary file not shown.
72 changes: 4 additions & 68 deletions src/components/theme/NewsletterForm/NewsletterForm.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,11 @@
import React, { useMemo } from 'react';
import { Button, Checkbox, Form } from 'semantic-ui-react';
import Logo from './Logo.png';
import React from 'react';
import newsLetterFormHTML from './newsLetterFormHTML'

import './newsletterForm.less';
const markup = { __html: newsLetterFormHTML };

const NewsletterForm = (props) => {
const query = useMemo(() => new URLSearchParams(props.location.search), [
props.location.search,
]);
const email = query.get('email');

const handleSubmit = (event) => {
const form = event.target;
const data =
form.checkboxPrivacy?.checked === true
? {
email,
firstName: form.firstName?.value,
lastName: form.lastName?.value,
organization: form.organization?.value,
checkboxPrivacy: form.checkboxPrivacy?.checked,
checkboxNewsletter: form.checkboxNewsletter?.checked,
}
: 'checkbox not selected';
return data;
};

return (
<div className="newsletterFormPage">
<a href="/">
<img className="newsletterLogo" src={Logo} alt="logo"></img>
</a>
<p>
Get the latest information about the European Scientific Advisory Board
on Climate Change
</p>
<hr style={{ width: '100%' }} />
<Form onSubmit={handleSubmit}>
<Form.Field>
<p className="required">First Name</p>
<input name="firstName" required />
</Form.Field>
<Form.Field>
<p className="required">Last Name</p>
<input name="lastName" required />
</Form.Field>
<Form.Field>
<p className="required">Organization</p>
<input name="organization" required />
</Form.Field>
<Form.Field>
<Checkbox
className="checkboxPrivacy"
name="checkboxPrivacy"
label="I agree to ESABCC’s Privacy Policy"
/>
</Form.Field>
<Form.Field>
<Checkbox
name="checkboxNewsletter"
label="I agree to have my response to ESABCC newsletters tracked (for example opned newsletter, link clicks, city location)"
/>
</Form.Field>
<Form.Field>
<a href="/">Link to Privacy Policy</a>
</Form.Field>
<Button className="newsletterButton" type="submit">
Subscribe
</Button>
</Form>
</div>
<div dangerouslySetInnerHTML={markup} ></div>
);
};

Expand Down
57 changes: 57 additions & 0 deletions src/components/theme/NewsletterForm/newsLetterFormHTML.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 0 additions & 52 deletions src/components/theme/NewsletterForm/newsletterForm.less

This file was deleted.

5 changes: 4 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
// All your imports required for the config here BEFORE this line
import '@plone/volto/config';

import installBlocks from './components/manage/Blocks';

export default function applyConfig(config) {
// Add here your project's configuration here by modifying `config` accordingly
return config;

return [installBlocks].reduce((acc, apply) => apply(acc), config);
}
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
</Dropdown>
</div> */}
<div className="search-ab">
<SearchWidget pathname={pathname} />
<SearchWidget pathname="" />
</div>
<Header.BurgerAction
className={`mobile ${burger} ${
Expand Down
Loading

0 comments on commit 8dff155

Please sign in to comment.