diff --git a/src/components/manage/Blocks/DetailedLink/View.jsx b/src/components/manage/Blocks/DetailedLink/View.jsx index 2f8fcfdb..3cb4d5ec 100644 --- a/src/components/manage/Blocks/DetailedLink/View.jsx +++ b/src/components/manage/Blocks/DetailedLink/View.jsx @@ -1,6 +1,7 @@ import React from 'react'; import { compose } from 'redux'; import { connect } from 'react-redux'; +import { useHistory } from 'react-router-dom'; import { Link } from 'react-router-dom'; import { settings } from '~/config'; import cx from 'classnames'; @@ -15,8 +16,13 @@ const getPath = (url) => { }; const View = (props) => { + const history = useHistory(); const detailedLink = props.data.detailedLink || null; - const { hideTitle = false, hideDescription = false } = props.data; + const { + backButton = false, + hideTitle = false, + hideDescription = false, + } = props.data; const { textAlign = null, title = '', @@ -36,58 +42,64 @@ const View = (props) => { `text-align-${textAlign || 'left'}`, )} > - {(detailedLink && ( - <> - {!hideTitle ? ( -
- {title || detailedLink.title || ''} + {detailedLink || + (backButton && ( + <> + {!hideTitle && (title || detailedLink?.title) ? ( +
+ {title || detailedLink?.title || ''} +
+ ) : ( + '' + )} + {!hideDescription && (description || detailedLink?.description) ? ( +

+ {description || detailedLink?.description || ''} +

+ ) : ( + '' + )} +
+ { + if ( + props.discodata_query.search.facilityInspireId || + props.discodata_query.search.installationInspireId || + props.discodata_query.search.lcpInspireId + ) { + props.deleteQueryParam({ + queryParam: [ + 'facilityInspireId', + 'installationInspireId', + 'lcpInspireId', + ], + }); + } + if (backButton) { + history.goBack(); + } + return e.preventDefault; + }} + to={!backButton && getPath(detailedLink?.path)} + > + {buttonTitle || detailedLink?.title || 'Go'} +
- ) : ( - '' - )} - {!hideDescription && (description || detailedLink.description) ? ( -

- {description || detailedLink.description || ''} -

- ) : ( - '' - )} -
- { - if ( - props.discodata_query.search.facilityInspireId || - props.discodata_query.search.installationInspireId || - props.discodata_query.search.lcpInspireId - ) { - props.deleteQueryParam({ - queryParam: [ - 'facilityInspireId', - 'installationInspireId', - 'lcpInspireId', - ], - }); - } - return e.preventDefault; - }} - to={getPath(detailedLink.path)} - > - {buttonTitle || detailedLink.title || 'Go'} - -
- - )) || ( -

Select a page from sidebar

- )} + + )) || ( +

+ Select a page from sidebar +

+ )}
); }; diff --git a/src/components/manage/Blocks/DetailedLink/schema.jsx b/src/components/manage/Blocks/DetailedLink/schema.jsx index 0a722c9c..1c66bc2d 100644 --- a/src/components/manage/Blocks/DetailedLink/schema.jsx +++ b/src/components/manage/Blocks/DetailedLink/schema.jsx @@ -12,6 +12,7 @@ export const getSchema = (props) => { id: 'properties', title: 'Properties', fields: [ + 'backButton', 'hideTitle', 'hideDescription', 'title', @@ -32,6 +33,10 @@ export const getSchema = (props) => { ], properties: { + backButton: { + title: 'Back button', + type: 'boolean', + }, hideTitle: { title: 'Hide title', type: 'boolean', diff --git a/theme/site/globals/site.overrides b/theme/site/globals/site.overrides index 49990241..e738e4e3 100644 --- a/theme/site/globals/site.overrides +++ b/theme/site/globals/site.overrides @@ -641,6 +641,7 @@ p { // BROWSE TABLE .browse-table { + overflow-x: auto; .ui.grid { margin-top: 0 !important; }