Skip to content

Commit

Permalink
feat: use ConditionalLink -refs #263347
Browse files Browse the repository at this point in the history
  • Loading branch information
ana-oprea committed May 7, 2024
1 parent 636719c commit 843d101
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 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 @@ -17,19 +17,16 @@ TagList.Content = ({ children }) => (
);

TagList.Tag = ({ children, href, openLinkInNewTab, showTagIcon }) => {
return href ? (
<UniversalLink
className="tag link"
href={getFieldURL(href)}
openLinkInNewTab={openLinkInNewTab}
>
{showTagIcon && <Icon className={`icon`} name="hashtag" />}
<span className="name">{children}</span>
</UniversalLink>
) : (
<div className="tag">
{showTagIcon && <Icon className={`icon`} name="hashtag" />}
<span className="name">{children}</span>
return (
<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 843d101

Please sign in to comment.