From 64a5f6de86f8adb9a67158ba9c51d548b0d1832d Mon Sep 17 00:00:00 2001 From: ducica Date: Mon, 14 Oct 2024 22:36:33 +0200 Subject: [PATCH] possible to not show links in community selector: --- .../CommunitySelector/CommunityItem.jsx | 32 +++++++++++++------ .../CommunitySelector/CommunitySelector.jsx | 2 ++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunityItem.jsx b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunityItem.jsx index 73a2b213..db04b39e 100644 --- a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunityItem.jsx +++ b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunityItem.jsx @@ -4,13 +4,14 @@ import Overridable from "react-overridable"; import PropTypes from "prop-types"; import { Image } from "react-invenio-forms"; -export const CommunityItem = ({ community, handleClick }) => { +export const CommunityItem = ({ community, handleClick, renderLinks }) => { const { id, title, website, logo, organizations } = community; return ( handleClick(id)} @@ -21,16 +22,22 @@ export const CommunityItem = ({ community, handleClick }) => {
- e.stopPropagation()} - href={community.links.self_html} - target="_blank" - rel="noopener noreferrer" - > - {title} - + {renderLinks ? ( + { + e.stopPropagation(); + }} + href={community.links.self_html} + target="_blank" + rel="noopener noreferrer" + > + {title} + + ) : ( + title + )}
- {website && ( + {website && renderLinks && ( { CommunityItem.propTypes = { community: PropTypes.object.isRequired, handleClick: PropTypes.func, + renderLinks: PropTypes.bool, +}; + +CommunityItem.defaultProps = { + renderLinks: true, }; diff --git a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunitySelector.jsx b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunitySelector.jsx index 741c6a31..8a1f8fa1 100644 --- a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunitySelector.jsx +++ b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/CommunitySelector/CommunitySelector.jsx @@ -80,6 +80,7 @@ export const CommunitySelector = ({ fieldPath }) => { key={c.id} community={c} handleClick={handleClick} + renderLinks={false} /> ))} @@ -97,6 +98,7 @@ export const CommunitySelector = ({ fieldPath }) => {