From 8b94ab16a983b6d538a040793733ac488ce27037 Mon Sep 17 00:00:00 2001 From: David Ichim Date: Wed, 30 Nov 2022 21:20:41 +0200 Subject: [PATCH] feat(tag): allow enabling and disabling of tag icon --- src/Tags/Tags.jsx | 4 ++-- src/TagsBlock/View.jsx | 3 ++- src/TagsBlock/schema.js | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Tags/Tags.jsx b/src/Tags/Tags.jsx index 6e5f307..da93d34 100644 --- a/src/Tags/Tags.jsx +++ b/src/Tags/Tags.jsx @@ -15,14 +15,14 @@ TagList.Content = ({ children }) => (
{children}
); -TagList.Tag = ({ children, href, openLinkInNewTab }) => { +TagList.Tag = ({ children, href, openLinkInNewTab, showTagIcon }) => { return ( - + {showTagIcon && } {children} ); diff --git a/src/TagsBlock/View.jsx b/src/TagsBlock/View.jsx index d2ed074..2502454 100644 --- a/src/TagsBlock/View.jsx +++ b/src/TagsBlock/View.jsx @@ -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

Add Tag items

; return ( @@ -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} diff --git a/src/TagsBlock/schema.js b/src/TagsBlock/schema.js index 7f91915..ba0503d 100644 --- a/src/TagsBlock/schema.js +++ b/src/TagsBlock/schema.js @@ -31,7 +31,7 @@ export default { { id: 'default', title: 'Default', - fields: ['title', 'position', 'items'], + fields: ['title', 'position', 'showTagIcon', 'items'], }, ], @@ -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',