Skip to content

Commit

Permalink
feat(tag): allow enabling and disabling of tag icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ichim-david committed Nov 30, 2022
1 parent 7086cbe commit 8b94ab1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Tags/Tags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ TagList.Content = ({ children }) => (
<div className="tags-content">{children}</div>
);

TagList.Tag = ({ children, href, openLinkInNewTab }) => {
TagList.Tag = ({ children, href, openLinkInNewTab, showTagIcon }) => {
return (
<UniversalLink
className="tag"
href={href}
openLinkInNewTab={openLinkInNewTab}
>
<Icon className={`icon`} name="hashtag" />
{showTagIcon && <Icon className={`icon`} name="hashtag" />}
<span className="name">{children}</span>
</UniversalLink>
);
Expand Down
3 changes: 2 additions & 1 deletion src/TagsBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import TagList from '@eeacms/volto-tags-block/Tags/Tags';

const View = ({ data, mode }) => {
const { items = [], title, position } = data;
const { items = [], title, position, showTagIcon } = data;

if (!items.length && mode === 'edit') return <p>Add Tag items</p>;
return (
Expand All @@ -17,6 +17,7 @@ const View = ({ data, mode }) => {
color={item.color || 'teal'}
href={item.href || '#'}
openLinkInNewTab={!!item.openLinkInNewTab}
showTagIcon={showTagIcon}
key={item.category}
>
{item.category}
Expand Down
6 changes: 5 additions & 1 deletion src/TagsBlock/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
{
id: 'default',
title: 'Default',
fields: ['title', 'position', 'items'],
fields: ['title', 'position', 'showTagIcon', 'items'],
},
],

Expand All @@ -44,6 +44,10 @@ export default {
title: 'Alignment',
widget: 'align',
},
showTagIcon: {
title: 'Enable tag items icon',
type: 'boolean',
},
items: {
title: 'Tag items',
widget: 'object_list',
Expand Down

0 comments on commit 8b94ab1

Please sign in to comment.