Skip to content

Commit

Permalink
feat(tags): add link class when tag has href -refs #263347 #23 from e…
Browse files Browse the repository at this point in the history
…ea/tags-as-links
  • Loading branch information
ichim-david committed May 7, 2024
2 parents 1b1798e + 1e439eb commit 06ebf5f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pipeline {
BACKEND_PROFILES = "eea.kitkat:testing"
BACKEND_ADDONS = ""
VOLTO = "17"
VOLTO16_BREAKING_CHANGES = "no"
VOLTO16_BREAKING_CHANGES = "yes"
IMAGE_NAME = BUILD_TAG.toLowerCase()
}

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/01-tags-block-basics.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Blocks Tests', () => {
cy.get('.tags-title').contains('Tags Demo');
cy.get('.tags .tags-content .tag').contains('test 1');
cy.get('.tags .tags-content .tag').contains('test 2');
cy.get('.tags .tags-content a[target="_blank"].tag').contains('test 2');
cy.get('.tags .tags-content a[target="_blank"]').contains('test 2');

cy.createContent({
contentType: 'Document',
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-tags-block",
"version": "2.0.0",
"version": "2.1.0",
"description": "@eeacms/volto-tags-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
20 changes: 11 additions & 9 deletions src/Tags/Tags.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import cx from 'classnames';
import { Icon } from 'semantic-ui-react';
import { UniversalLink } from '@plone/volto/components';
import { ConditionalLink } from '@plone/volto/components';
import { getFieldURL } from '@eeacms/volto-tags-block/helpers';

function TagList({ children, position }) {
Expand All @@ -18,14 +18,16 @@ TagList.Content = ({ children }) => (

TagList.Tag = ({ children, href, openLinkInNewTab, showTagIcon }) => {
return (
<UniversalLink
className="tag"
href={getFieldURL(href)}
openLinkInNewTab={openLinkInNewTab}
>
{showTagIcon && <Icon className={`icon`} name="hashtag" />}
<span className="name">{children}</span>
</UniversalLink>
<div className={`tag ${href ? 'link' : ''}`}>
<ConditionalLink
condition={href}
to={href ? getFieldURL(href) : null}
openLinkInNewTab={openLinkInNewTab}
>
{showTagIcon && <Icon className={`icon`} name="hashtag" />}
<span className="name">{children}</span>
</ConditionalLink>
</div>
);
};

Expand Down

0 comments on commit 06ebf5f

Please sign in to comment.