Skip to content

Commit

Permalink
Merge pull request #2 from eea/develop
Browse files Browse the repository at this point in the history
fix(call-to-action): Icon right for link theme
  • Loading branch information
avoinea authored Jun 2, 2022
2 parents fdc1461 + 0f592d5 commit ad039a5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
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.2.1](https://github.com/eea/volto-call-to-action-block/compare/0.2.0...0.2.1)

- fix(call-to-action): Icon right for link theme [`b69ca24`](https://github.com/eea/volto-call-to-action-block/commit/b69ca24ba8b0ce75b8da4df5cc5e2adf5ec7d0f6)

#### [0.2.0](https://github.com/eea/volto-call-to-action-block/compare/0.1.0...0.2.0)

> 31 May 2022
- Release [`#1`](https://github.com/eea/volto-call-to-action-block/pull/1)
- Release 0.2.0 [`ae6c18d`](https://github.com/eea/volto-call-to-action-block/commit/ae6c18d84f502829f254ac62d0792040a9854418)
- Add cypress basic tests [`fd5b04b`](https://github.com/eea/volto-call-to-action-block/commit/fd5b04b43cfcd01e6ddd32b7c16e5db4a8cadb22)
- Cleanup: style defaults [`f682eca`](https://github.com/eea/volto-call-to-action-block/commit/f682eca484fe3aab0ab7ab774115df6548290f41)
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-call-to-action-block",
"version": "0.2.0",
"version": "0.2.1",
"description": "@eeacms/volto-call-to-action-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
17 changes: 14 additions & 3 deletions src/components/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ import cx from 'classnames';
import { Link } from 'react-router-dom';
import { flattenToAppURL, isInternalURL } from '@plone/volto/helpers';

const Content = ({ data }) =>
data.styles?.rightIcon ? (
<>
{data.text}
{data.styles?.icon ? <Icon className={data.styles?.icon} /> : ''}
</>
) : (
<>
{data.styles?.icon ? <Icon className={data.styles?.icon} /> : ''}
{data.text}
</>
);

const View = ({ data, isEditMode }) => {
const [hasLink, setHasLink] = React.useState(false);

Expand All @@ -23,7 +36,6 @@ const View = ({ data, isEditMode }) => {
}, [isEditMode, data.href]);

const As = hasLink && isInternalURL(data.href[0]['@id']) ? Link : 'a';

return (
<div className={cx('block call-to-action align', data.styles?.align)}>
<As
Expand All @@ -42,8 +54,7 @@ const View = ({ data, isEditMode }) => {
title={hasLink ? data.href[0]['title'] : ''}
target={data.target}
>
{data.styles?.icon && <Icon className={data.styles?.icon} />}
{data.text}
<Content data={data} />
</As>
</div>
);
Expand Down

0 comments on commit ad039a5

Please sign in to comment.