design-comuni-plone-theme 11.9.0 → 11.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/performance.yml +47 -0
- package/.yarn/cache/minipass-npm-5.0.0-c64fb63c92-425dab2887.zip +0 -0
- package/.yarn/cache/tar-npm-6.2.1-237800bb20-f1322768c9.zip +0 -0
- package/.yarn/cache/{volto-gdpr-privacy-npm-2.1.1-414b7e6a62-2246b94027.zip → volto-gdpr-privacy-npm-2.2.0-6be0f74d53-8a93254251.zip} +0 -0
- package/.yarn/cache/volto-slimheader-npm-0.1.1-6c4a32fae4-94bafa197c.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +60 -0
- package/RELEASE.md +33 -0
- package/locales/de/LC_MESSAGES/volto.po +61 -36
- package/locales/en/LC_MESSAGES/volto.po +63 -38
- package/locales/es/LC_MESSAGES/volto.po +61 -36
- package/locales/fr/LC_MESSAGES/volto.po +62 -37
- package/locales/it/LC_MESSAGES/volto.po +61 -36
- package/locales/volto.pot +62 -37
- package/package.json +5 -3
- package/publiccode.yml +2 -2
- package/src/components/ItaliaTheme/AppExtras/TrackFocus.jsx +47 -0
- package/src/components/ItaliaTheme/Blocks/Accordion/View.jsx +1 -1
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/BodyWrapper.jsx +8 -3
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/BottomBody.jsx +25 -16
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Edit.jsx +10 -2
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Sidebar.jsx +39 -3
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/View.jsx +31 -16
- package/src/components/ItaliaTheme/Blocks/Calendar/Body.jsx +23 -59
- package/src/components/ItaliaTheme/Blocks/Common/SearchFilters/SelectFilter.jsx +9 -1
- package/src/components/ItaliaTheme/Blocks/EventSearch/DefaultFilters.js +5 -0
- package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +17 -0
- package/src/components/ItaliaTheme/Blocks/Listing/CardWithImage/CardWithImageDefault.jsx +182 -0
- package/src/components/ItaliaTheme/Blocks/Listing/CardWithImageTemplate.jsx +7 -173
- package/src/components/ItaliaTheme/Blocks/Listing/Commons/utils.js +0 -70
- package/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx +24 -36
- package/src/components/ItaliaTheme/Blocks/Listing/SimpleCard/Card/SimpleCardDefault.jsx +177 -0
- package/src/components/ItaliaTheme/Blocks/Listing/SimpleCard/SimpleCardTemplateDefault.jsx +8 -170
- package/src/components/ItaliaTheme/Blocks/Listing/Slider/SlideItemDefault.jsx +65 -0
- package/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx +62 -212
- package/src/components/ItaliaTheme/Blocks/VideoGallery/Body.jsx +10 -48
- package/src/components/ItaliaTheme/Blocks/VideoGallery/Edit.jsx +3 -2
- package/src/components/ItaliaTheme/Blocks/VideoGallery/View.jsx +3 -2
- package/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +6 -0
- package/src/components/ItaliaTheme/Header/HeaderSlim/TertiaryMenu.jsx +34 -5
- package/src/components/ItaliaTheme/Icons/FontAwesomeIcon.jsx +2 -0
- package/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +8 -2
- package/src/components/ItaliaTheme/MenuSecondary/MenuSecondary.jsx +3 -0
- package/src/components/ItaliaTheme/Slider/ButtonPlayPause.jsx +48 -0
- package/src/components/ItaliaTheme/Slider/CarouselWrapper.jsx +23 -0
- package/src/components/ItaliaTheme/Slider/NextArrow.jsx +31 -0
- package/src/components/ItaliaTheme/Slider/PrevArrow.jsx +33 -0
- package/src/components/ItaliaTheme/Slider/SingleSlideWrapper.jsx +39 -0
- package/src/components/ItaliaTheme/Slider/slider.js +203 -0
- package/src/components/ItaliaTheme/View/Commons/ContactLink.jsx +3 -2
- package/src/components/ItaliaTheme/View/Commons/Dates.jsx +12 -4
- package/src/components/ItaliaTheme/View/Commons/Gallery.jsx +13 -9
- package/src/components/ItaliaTheme/View/Commons/Metadata.jsx +1 -1
- package/src/components/ItaliaTheme/View/Commons/RenderBlocks.jsx +20 -7
- package/src/components/ItaliaTheme/View/DocumentoView/DocumentoDescrizione.jsx +15 -7
- package/src/components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreEsterno.jsx +12 -1
- package/src/components/ItaliaTheme/View/EventoView/EventoLuoghi.jsx +7 -7
- package/src/components/ItaliaTheme/View/UOView/UOServices.jsx +1 -1
- package/src/components/ItaliaTheme/View/__tests__/ServizioMetadati.test.jsx +1 -1
- package/src/components/ItaliaTheme/index.js +7 -2
- package/src/config/Blocks/ListingOptions/cardWithImageTemplate.js +18 -2
- package/src/config/Blocks/ListingOptions/simpleCardTemplate.js +34 -17
- package/src/config/Blocks/ListingOptions/sliderTemplate.js +68 -11
- package/src/config/Blocks/listingVariations.js +8 -0
- package/src/config/italiaConfig.js +13 -2
- package/src/customizations/volto/components/manage/Blocks/Listing/ListingBody.jsx +5 -0
- package/src/customizations/volto/components/manage/Blocks/Search/components/SelectFacetFilterListEntry.jsx +43 -36
- package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +8 -3
- package/src/customizations/volto/components/manage/Widgets/FileWidget.jsx +2 -2
- package/src/customizations/volto/components/theme/Navigation/Navigation.jsx +5 -1
- package/src/customizations/volto/components/theme/Sitemap/Sitemap.jsx +126 -0
- package/src/helpers/config.js +1 -1
- package/src/theme/ItaliaTheme/Blocks/_argumentsInEvidence.scss +4 -4
- package/src/theme/ItaliaTheme/Blocks/{_cardWithImageAndInEvidence.scss → _cardWithImage.scss} +63 -38
- package/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +7 -6
- package/src/theme/ItaliaTheme/Blocks/_inEvidenceTemplate.scss +123 -0
- package/src/theme/ItaliaTheme/Blocks/_simpleCardTemplate.scss +65 -67
- package/src/theme/ItaliaTheme/Blocks/_sliderTemplate.scss +81 -0
- package/src/theme/ItaliaTheme/Blocks/common/_searchBlockFilters.scss +16 -0
- package/src/theme/ItaliaTheme/Components/_cardPersona.scss +1 -1
- package/src/theme/ItaliaTheme/Components/_mobileMenu.scss +1 -1
- package/src/theme/ItaliaTheme/Components/_navigation.scss +15 -0
- package/src/theme/ItaliaTheme/Components/_tertiaryMenu.scss +6 -0
- package/src/theme/ItaliaTheme/Print/_all_pages.scss +33 -0
- package/src/theme/ItaliaTheme/Print/_page.scss +21 -0
- package/src/theme/ItaliaTheme/Print/_uo.scss +7 -2
- package/src/theme/ItaliaTheme/Views/_common.scss +4 -0
- package/src/theme/bootstrap-override/bootstrap-italia/_chips.scss +16 -1
- package/src/theme/bootstrap-override/bootstrap-italia/_footer.scss +2 -0
- package/src/theme/site.scss +4 -2
- package/.yarn/cache/nanoid-npm-3.3.4-3d250377d6-2fddd6dee9.zip +0 -0
- package/.yarn/cache/postcss-npm-8.4.16-7367383579-10eee25efd.zip +0 -0
- package/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-a04c07bb9e.zip +0 -0
- package/src/components/ItaliaTheme/Blocks/Listing/Commons/NextArrow.jsx +0 -10
- package/src/components/ItaliaTheme/Blocks/Listing/Commons/PrevArrow.jsx +0 -10
- package/src/theme/ItaliaTheme/Blocks/_inevidencetemplate.scss +0 -34
|
@@ -3,8 +3,11 @@ import { useDispatch, useSelector } from 'react-redux';
|
|
|
3
3
|
import { useIntl, defineMessages } from 'react-intl';
|
|
4
4
|
import useDeepCompareEffect from 'use-deep-compare-effect';
|
|
5
5
|
import {
|
|
6
|
-
FontAwesomeIcon,
|
|
7
6
|
ListingLinkMore,
|
|
7
|
+
CarouselWrapper,
|
|
8
|
+
SingleSlideWrapper,
|
|
9
|
+
NextArrow,
|
|
10
|
+
PrevArrow,
|
|
8
11
|
} from 'design-comuni-plone-theme/components/ItaliaTheme';
|
|
9
12
|
import { Card, Row, Col, Container, Button } from 'design-react-kit';
|
|
10
13
|
import cx from 'classnames';
|
|
@@ -28,14 +31,6 @@ const messages = defineMessages({
|
|
|
28
31
|
id: 'calendar_no_results',
|
|
29
32
|
defaultMessage: 'Nessun evento disponibile al momento',
|
|
30
33
|
},
|
|
31
|
-
calendar_next_arrow: {
|
|
32
|
-
id: 'calendar_next_arrow',
|
|
33
|
-
defaultMessage: 'Prossimi eventi',
|
|
34
|
-
},
|
|
35
|
-
calendar_prev_arrow: {
|
|
36
|
-
id: 'calendar_prev_arrow',
|
|
37
|
-
defaultMessage: 'Eventi precedenti',
|
|
38
|
-
},
|
|
39
34
|
});
|
|
40
35
|
|
|
41
36
|
const copyFields = ['limit', 'query', 'sort_on', 'sort_order', 'depth'];
|
|
@@ -169,43 +164,6 @@ const Body = ({ data, block, inEditMode, path, onChangeBlock, reactSlick }) => {
|
|
|
169
164
|
setAdditionalFilters(filters);
|
|
170
165
|
};
|
|
171
166
|
|
|
172
|
-
const NextArrow = (props) => {
|
|
173
|
-
const { onClick, className } = props;
|
|
174
|
-
return (
|
|
175
|
-
<Button
|
|
176
|
-
outline
|
|
177
|
-
color={'unset'}
|
|
178
|
-
className={className}
|
|
179
|
-
onClick={onClick}
|
|
180
|
-
aria-label={intl.formatMessage(messages.calendar_next_arrow)}
|
|
181
|
-
>
|
|
182
|
-
<FontAwesomeIcon
|
|
183
|
-
aria-hidden={true}
|
|
184
|
-
icon={['fas', 'chevron-right']}
|
|
185
|
-
title={intl.formatMessage(messages.calendar_next_arrow)}
|
|
186
|
-
/>
|
|
187
|
-
</Button>
|
|
188
|
-
);
|
|
189
|
-
};
|
|
190
|
-
const PrevArrow = (props) => {
|
|
191
|
-
const { onClick, className } = props;
|
|
192
|
-
return (
|
|
193
|
-
<Button
|
|
194
|
-
outline
|
|
195
|
-
color={'unset'}
|
|
196
|
-
className={className}
|
|
197
|
-
onClick={onClick}
|
|
198
|
-
aria-label={intl.formatMessage(messages.calendar_prev_arrow)}
|
|
199
|
-
>
|
|
200
|
-
<FontAwesomeIcon
|
|
201
|
-
aria-hidden={true}
|
|
202
|
-
icon={['fas', 'chevron-left']}
|
|
203
|
-
title={intl.formatMessage(messages.calendar_prev_arrow)}
|
|
204
|
-
/>
|
|
205
|
-
</Button>
|
|
206
|
-
);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
167
|
const settings = {
|
|
210
168
|
dots: true,
|
|
211
169
|
arrows: true,
|
|
@@ -330,19 +288,25 @@ const Body = ({ data, block, inEditMode, path, onChangeBlock, reactSlick }) => {
|
|
|
330
288
|
</div>
|
|
331
289
|
<div className="calendar-body">
|
|
332
290
|
{calendarResults[block]?.items?.length > 0 ? (
|
|
333
|
-
<
|
|
334
|
-
{
|
|
335
|
-
|
|
336
|
-
<
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
291
|
+
<CarouselWrapper>
|
|
292
|
+
<Slider {...settings}>
|
|
293
|
+
{calendarResults[block].items.map((day, index) => (
|
|
294
|
+
<SingleSlideWrapper
|
|
295
|
+
index={index}
|
|
296
|
+
key={index}
|
|
297
|
+
className="body"
|
|
298
|
+
>
|
|
299
|
+
<Item
|
|
300
|
+
data={data}
|
|
301
|
+
day={day}
|
|
302
|
+
query={adaptedQuery}
|
|
303
|
+
path={path}
|
|
304
|
+
inEditMode={inEditMode}
|
|
305
|
+
/>
|
|
306
|
+
</SingleSlideWrapper>
|
|
307
|
+
))}
|
|
308
|
+
</Slider>
|
|
309
|
+
</CarouselWrapper>
|
|
346
310
|
) : inEditMode ? (
|
|
347
311
|
<span className="no-results">
|
|
348
312
|
{intl.formatMessage(messages.insert_filter)}
|
|
@@ -4,7 +4,14 @@ import { SelectInput } from 'design-comuni-plone-theme/components';
|
|
|
4
4
|
import { useDispatch, useSelector } from 'react-redux';
|
|
5
5
|
import { searchContent, getVocabulary } from '@plone/volto/actions';
|
|
6
6
|
|
|
7
|
-
const SelectFilter = ({
|
|
7
|
+
const SelectFilter = ({
|
|
8
|
+
options,
|
|
9
|
+
value,
|
|
10
|
+
id,
|
|
11
|
+
onChange,
|
|
12
|
+
placeholder,
|
|
13
|
+
isSearchable = false,
|
|
14
|
+
}) => {
|
|
8
15
|
const dispatch = useDispatch();
|
|
9
16
|
|
|
10
17
|
const state = useSelector((state) => {
|
|
@@ -64,6 +71,7 @@ const SelectFilter = ({ options, value, id, onChange, placeholder }) => {
|
|
|
64
71
|
}}
|
|
65
72
|
options={select_options?.filter((opt) => !!opt.value?.toString()) ?? []}
|
|
66
73
|
isClearable={true}
|
|
74
|
+
isSearchable={isSearchable}
|
|
67
75
|
// components={{
|
|
68
76
|
// ClearIndicator: (props) => {
|
|
69
77
|
// const {
|
|
@@ -65,6 +65,7 @@ const DefaultFilters = () => {
|
|
|
65
65
|
component: SelectFilter,
|
|
66
66
|
props: {
|
|
67
67
|
value: null,
|
|
68
|
+
isSearchable: true,
|
|
68
69
|
options: {
|
|
69
70
|
dispatch: {
|
|
70
71
|
path: subsite ? flattenToAppURL(subsite['@id']) : '/',
|
|
@@ -72,6 +73,10 @@ const DefaultFilters = () => {
|
|
|
72
73
|
fullobjects: 0,
|
|
73
74
|
b_size: 10000,
|
|
74
75
|
subrequests_name: 'venues',
|
|
76
|
+
additionalParams: {
|
|
77
|
+
sort_on: 'sortable_title',
|
|
78
|
+
sort_order: 'ascending',
|
|
79
|
+
},
|
|
75
80
|
},
|
|
76
81
|
placeholder: intl.formatMessage(messages.venues),
|
|
77
82
|
},
|
|
@@ -10,6 +10,7 @@ import { useIntl, defineMessages } from 'react-intl';
|
|
|
10
10
|
import { UniversalLink } from '@plone/volto/components';
|
|
11
11
|
|
|
12
12
|
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
|
|
13
|
+
import { RichTextRender } from 'design-comuni-plone-theme/components/ItaliaTheme/View';
|
|
13
14
|
import { Card, CardBody, CardReadMore } from 'design-react-kit';
|
|
14
15
|
import config from '@plone/volto/registry';
|
|
15
16
|
|
|
@@ -26,6 +27,19 @@ const messages = defineMessages({
|
|
|
26
27
|
* @extends Component
|
|
27
28
|
*/
|
|
28
29
|
const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
|
|
30
|
+
const rawStringRenderer = {
|
|
31
|
+
blocks: {
|
|
32
|
+
unstyled: (children) => {
|
|
33
|
+
const text = children.map((child) => child[1]).join(''); // Join the text elements
|
|
34
|
+
return text.trim(); // Remove leading/trailing whitespace
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const cardTitle = redraft(data.title, rawStringRenderer, {
|
|
40
|
+
cleanup: false,
|
|
41
|
+
});
|
|
42
|
+
|
|
29
43
|
const intl = useIntl();
|
|
30
44
|
return (
|
|
31
45
|
<Card
|
|
@@ -65,6 +79,9 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
|
|
|
65
79
|
tag={UniversalLink}
|
|
66
80
|
href={data.href ?? '#'}
|
|
67
81
|
text={data.linkMoreTitle || intl.formatMessage(messages.vedi)}
|
|
82
|
+
aria-label={`${
|
|
83
|
+
data.linkMoreTitle || intl.formatMessage(messages.vedi)
|
|
84
|
+
} ${data.title ? cardTitle[0] : ''}`}
|
|
68
85
|
/>
|
|
69
86
|
)}
|
|
70
87
|
</CardBody>
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* componente per visulizzare un elemento del template 'Card con immagine' del blocco listing con l'aspetto di default.
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import cx from 'classnames';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Card,
|
|
10
|
+
CardBody,
|
|
11
|
+
CardTitle,
|
|
12
|
+
CardText,
|
|
13
|
+
Chip,
|
|
14
|
+
ChipLabel,
|
|
15
|
+
} from 'design-react-kit';
|
|
16
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
17
|
+
import { UniversalLink } from '@plone/volto/components';
|
|
18
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
19
|
+
import { CardCategory } from 'design-comuni-plone-theme/components/ItaliaTheme';
|
|
20
|
+
import {
|
|
21
|
+
getCalendarDate,
|
|
22
|
+
getEventRecurrenceMore,
|
|
23
|
+
getComponentWithFallback,
|
|
24
|
+
} from 'design-comuni-plone-theme/helpers';
|
|
25
|
+
import { getCategory } from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Listing/Commons/utils';
|
|
26
|
+
|
|
27
|
+
import {
|
|
28
|
+
getItemIcon,
|
|
29
|
+
CardCalendar,
|
|
30
|
+
ListingCategory,
|
|
31
|
+
ListingImage,
|
|
32
|
+
ListingText,
|
|
33
|
+
CardPersona,
|
|
34
|
+
} from 'design-comuni-plone-theme/components/ItaliaTheme';
|
|
35
|
+
|
|
36
|
+
const CardWithImageDefault = (props) => {
|
|
37
|
+
const {
|
|
38
|
+
item,
|
|
39
|
+
index,
|
|
40
|
+
isEditMode,
|
|
41
|
+
always_show_image = false,
|
|
42
|
+
set_four_columns = false,
|
|
43
|
+
show_type = true,
|
|
44
|
+
show_section,
|
|
45
|
+
show_icon = true,
|
|
46
|
+
show_description = true,
|
|
47
|
+
show_topics = true,
|
|
48
|
+
hide_dates = false,
|
|
49
|
+
natural_image_size = false,
|
|
50
|
+
id_lighthouse,
|
|
51
|
+
rrule,
|
|
52
|
+
} = props;
|
|
53
|
+
|
|
54
|
+
const imagesToShow = set_four_columns ? 4 : 3;
|
|
55
|
+
|
|
56
|
+
const icon = show_icon ? getItemIcon(item) : null;
|
|
57
|
+
const date = hide_dates ? null : getCalendarDate(item, rrule.rrulestr);
|
|
58
|
+
const eventRecurrenceMore = hide_dates
|
|
59
|
+
? null
|
|
60
|
+
: getEventRecurrenceMore(item, isEditMode);
|
|
61
|
+
const listingText = show_description ? <ListingText item={item} /> : null;
|
|
62
|
+
|
|
63
|
+
const image = ListingImage({ item, showTitleAttr: false });
|
|
64
|
+
|
|
65
|
+
const showImage =
|
|
66
|
+
(index < imagesToShow || always_show_image) && image != null;
|
|
67
|
+
const category = getCategory(item, show_type, show_section, props);
|
|
68
|
+
const topics = show_topics ? item.tassonomia_argomenti : null;
|
|
69
|
+
|
|
70
|
+
const BlockExtraTags = getComponentWithFallback({
|
|
71
|
+
name: 'BlockExtraTags',
|
|
72
|
+
dependencies: ['CardWithImageDefault', item['@type']],
|
|
73
|
+
}).component;
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
{item['@type'] === 'Persona' ? (
|
|
78
|
+
<CardPersona
|
|
79
|
+
item={item}
|
|
80
|
+
className="card-bg shadow-sm"
|
|
81
|
+
showImage={showImage}
|
|
82
|
+
natural_image_size={natural_image_size}
|
|
83
|
+
show_description={show_description}
|
|
84
|
+
icon={icon}
|
|
85
|
+
type={category}
|
|
86
|
+
isEditMode={isEditMode}
|
|
87
|
+
/>
|
|
88
|
+
) : (
|
|
89
|
+
<Card
|
|
90
|
+
className={cx(
|
|
91
|
+
'card-with-image-default-item listing-item card-bg no-after',
|
|
92
|
+
{
|
|
93
|
+
'card-teaser-image card-flex': item['@type'] === 'Persona',
|
|
94
|
+
},
|
|
95
|
+
)}
|
|
96
|
+
>
|
|
97
|
+
{/* wrapperClassName="card-overlapping" */}
|
|
98
|
+
{showImage && (
|
|
99
|
+
<div
|
|
100
|
+
className={cx('img-responsive-wrapper', {
|
|
101
|
+
'natural-image-size': natural_image_size,
|
|
102
|
+
})}
|
|
103
|
+
>
|
|
104
|
+
<div className="img-responsive img-responsive-panoramic">
|
|
105
|
+
<figure className="img-wrapper">{image}</figure>
|
|
106
|
+
{item['@type'] === 'Event' && (
|
|
107
|
+
<CardCalendar
|
|
108
|
+
start={item.start}
|
|
109
|
+
end={item.end}
|
|
110
|
+
recurrence={item.recurrence}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
<CardBody className="px-4">
|
|
117
|
+
{(icon || category || date) && (
|
|
118
|
+
<CardCategory iconName={icon} date={date}>
|
|
119
|
+
<ListingCategory category={category} item={item} />
|
|
120
|
+
</CardCategory>
|
|
121
|
+
)}
|
|
122
|
+
<CardTitle tag="h3">
|
|
123
|
+
<UniversalLink
|
|
124
|
+
item={!isEditMode ? item : null}
|
|
125
|
+
href={isEditMode ? '#' : ''}
|
|
126
|
+
data-element={id_lighthouse}
|
|
127
|
+
tabIndex={0}
|
|
128
|
+
>
|
|
129
|
+
{item.title || item.id}
|
|
130
|
+
</UniversalLink>
|
|
131
|
+
</CardTitle>
|
|
132
|
+
{listingText && (
|
|
133
|
+
<CardText
|
|
134
|
+
className={cx('', {
|
|
135
|
+
'mb-3': topics?.length > 0,
|
|
136
|
+
})}
|
|
137
|
+
>
|
|
138
|
+
{listingText}
|
|
139
|
+
</CardText>
|
|
140
|
+
)}
|
|
141
|
+
<BlockExtraTags {...props} item={item} itemIndex={index} />
|
|
142
|
+
{topics?.length > 0 && (
|
|
143
|
+
<div
|
|
144
|
+
className={cx('', {
|
|
145
|
+
'mb-3': eventRecurrenceMore,
|
|
146
|
+
})}
|
|
147
|
+
>
|
|
148
|
+
{topics.map((argument, index) => (
|
|
149
|
+
<UniversalLink
|
|
150
|
+
href={flattenToAppURL(argument['@id'])}
|
|
151
|
+
key={index}
|
|
152
|
+
title={argument.title}
|
|
153
|
+
className="text-decoration-none"
|
|
154
|
+
>
|
|
155
|
+
<Chip
|
|
156
|
+
color="primary"
|
|
157
|
+
disabled={false}
|
|
158
|
+
simple
|
|
159
|
+
tag="div"
|
|
160
|
+
className="me-2"
|
|
161
|
+
>
|
|
162
|
+
<ChipLabel tag="span">{argument.title}</ChipLabel>
|
|
163
|
+
</Chip>
|
|
164
|
+
</UniversalLink>
|
|
165
|
+
))}
|
|
166
|
+
</div>
|
|
167
|
+
)}
|
|
168
|
+
|
|
169
|
+
{eventRecurrenceMore}
|
|
170
|
+
</CardBody>
|
|
171
|
+
</Card>
|
|
172
|
+
)}
|
|
173
|
+
</>
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
CardWithImageDefault.propTypes = {
|
|
178
|
+
item: PropTypes.any.isRequired,
|
|
179
|
+
isEditMode: PropTypes.bool,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export default injectLazyLibs(['rrule'])(CardWithImageDefault);
|
|
@@ -1,68 +1,28 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* componente per visulizzare
|
|
2
|
+
* componente per visulizzare i risultati del blocco Listing con il template 'Card con immagine'
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
Row,
|
|
11
|
-
Col,
|
|
12
|
-
Card,
|
|
13
|
-
CardBody,
|
|
14
|
-
CardTitle,
|
|
15
|
-
CardText,
|
|
16
|
-
Chip,
|
|
17
|
-
ChipLabel,
|
|
18
|
-
} from 'design-react-kit';
|
|
19
|
-
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
20
|
-
import { UniversalLink } from '@plone/volto/components';
|
|
21
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
22
|
-
import {
|
|
23
|
-
CardCategory,
|
|
24
|
-
ListingLinkMore,
|
|
25
|
-
} from 'design-comuni-plone-theme/components/ItaliaTheme';
|
|
26
|
-
import {
|
|
27
|
-
getCalendarDate,
|
|
28
|
-
getEventRecurrenceMore,
|
|
29
|
-
getComponentWithFallback,
|
|
30
|
-
} from 'design-comuni-plone-theme/helpers';
|
|
31
|
-
import { getCategory } from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Listing/Commons/utils';
|
|
8
|
+
import { Container, Row, Col } from 'design-react-kit';
|
|
9
|
+
import { ListingLinkMore } from 'design-comuni-plone-theme/components/ItaliaTheme';
|
|
32
10
|
|
|
33
|
-
import
|
|
34
|
-
getItemIcon,
|
|
35
|
-
CardCalendar,
|
|
36
|
-
ListingCategory,
|
|
37
|
-
ListingImage,
|
|
38
|
-
ListingText,
|
|
39
|
-
CardPersona,
|
|
40
|
-
} from 'design-comuni-plone-theme/components/ItaliaTheme';
|
|
11
|
+
import CardWithImageDefault from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Listing/CardWithImage/CardWithImageDefault';
|
|
41
12
|
|
|
42
13
|
const CardWithImageTemplate = (props) => {
|
|
43
14
|
const {
|
|
44
15
|
items,
|
|
45
|
-
isEditMode,
|
|
46
16
|
title,
|
|
47
17
|
linkAlign,
|
|
48
18
|
linkTitle,
|
|
49
19
|
linkHref,
|
|
50
20
|
show_block_bg = false,
|
|
51
|
-
always_show_image = false,
|
|
52
21
|
set_four_columns = false,
|
|
53
|
-
show_type = false,
|
|
54
|
-
show_section,
|
|
55
|
-
show_icon = true,
|
|
56
|
-
show_description = true,
|
|
57
|
-
show_topics = true,
|
|
58
|
-
hide_dates = false,
|
|
59
|
-
natural_image_size = false,
|
|
60
|
-
id_lighthouse,
|
|
61
22
|
linkmore_id_lighthouse,
|
|
62
23
|
titleLine,
|
|
63
|
-
rrule,
|
|
64
24
|
} = props;
|
|
65
|
-
|
|
25
|
+
|
|
66
26
|
return (
|
|
67
27
|
<div className="card-with-image-template">
|
|
68
28
|
<Container className="px-4">
|
|
@@ -82,28 +42,6 @@ const CardWithImageTemplate = (props) => {
|
|
|
82
42
|
)}
|
|
83
43
|
<Row className="items">
|
|
84
44
|
{items.map((item, index) => {
|
|
85
|
-
const icon = show_icon ? getItemIcon(item) : null;
|
|
86
|
-
const date = hide_dates
|
|
87
|
-
? null
|
|
88
|
-
: getCalendarDate(item, rrule.rrulestr);
|
|
89
|
-
const eventRecurrenceMore = hide_dates
|
|
90
|
-
? null
|
|
91
|
-
: getEventRecurrenceMore(item, isEditMode);
|
|
92
|
-
const listingText = show_description ? (
|
|
93
|
-
<ListingText item={item} />
|
|
94
|
-
) : null;
|
|
95
|
-
|
|
96
|
-
const image = ListingImage({ item, showTitleAttr: false });
|
|
97
|
-
|
|
98
|
-
const showImage =
|
|
99
|
-
(index < imagesToShow || always_show_image) && image != null;
|
|
100
|
-
const category = getCategory(item, show_type, show_section, props);
|
|
101
|
-
const topics = show_topics ? item.tassonomia_argomenti : null;
|
|
102
|
-
|
|
103
|
-
const BlockExtraTags = getComponentWithFallback({
|
|
104
|
-
name: 'BlockExtraTags',
|
|
105
|
-
dependencies: ['CardWithImageTemplate', item['@type']],
|
|
106
|
-
}).component;
|
|
107
45
|
const layoutSelected = set_four_columns ? '3' : '4';
|
|
108
46
|
|
|
109
47
|
return (
|
|
@@ -113,111 +51,7 @@ const CardWithImageTemplate = (props) => {
|
|
|
113
51
|
key={item['@id']}
|
|
114
52
|
className="col-item mb-3"
|
|
115
53
|
>
|
|
116
|
-
{item
|
|
117
|
-
<CardPersona
|
|
118
|
-
item={item}
|
|
119
|
-
className="card-bg shadow-sm"
|
|
120
|
-
showImage={showImage}
|
|
121
|
-
natural_image_size={natural_image_size}
|
|
122
|
-
show_description={show_description}
|
|
123
|
-
icon={icon}
|
|
124
|
-
type={category}
|
|
125
|
-
isEditMode={isEditMode}
|
|
126
|
-
/>
|
|
127
|
-
) : (
|
|
128
|
-
<Card
|
|
129
|
-
className={cx('listing-item card-bg', {
|
|
130
|
-
'card-teaser-image card-flex no-after':
|
|
131
|
-
item['@type'] === 'Persona',
|
|
132
|
-
})}
|
|
133
|
-
>
|
|
134
|
-
{/* wrapperClassName="card-overlapping" */}
|
|
135
|
-
{showImage && (
|
|
136
|
-
<div
|
|
137
|
-
className={cx('img-responsive-wrapper', {
|
|
138
|
-
'natural-image-size': natural_image_size,
|
|
139
|
-
})}
|
|
140
|
-
>
|
|
141
|
-
<div className="img-responsive img-responsive-panoramic">
|
|
142
|
-
<figure className="img-wrapper">{image}</figure>
|
|
143
|
-
{item['@type'] === 'Event' && (
|
|
144
|
-
<CardCalendar
|
|
145
|
-
start={item.start}
|
|
146
|
-
end={item.end}
|
|
147
|
-
recurrence={item.recurrence}
|
|
148
|
-
/>
|
|
149
|
-
)}
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
)}
|
|
153
|
-
<CardBody className="px-4">
|
|
154
|
-
{(icon || category || date) && (
|
|
155
|
-
<CardCategory
|
|
156
|
-
iconName={icon}
|
|
157
|
-
date={date}
|
|
158
|
-
className={cx('category-top categoryicon-top', {
|
|
159
|
-
'wrap-dates-four-columns': set_four_columns,
|
|
160
|
-
})}
|
|
161
|
-
>
|
|
162
|
-
<ListingCategory category={category} item={item} />
|
|
163
|
-
</CardCategory>
|
|
164
|
-
)}
|
|
165
|
-
<CardTitle tag="h3">
|
|
166
|
-
<UniversalLink
|
|
167
|
-
item={!isEditMode ? item : null}
|
|
168
|
-
href={isEditMode ? '#' : ''}
|
|
169
|
-
data-element={id_lighthouse}
|
|
170
|
-
>
|
|
171
|
-
{item.title || item.id}
|
|
172
|
-
</UniversalLink>
|
|
173
|
-
</CardTitle>
|
|
174
|
-
{listingText && (
|
|
175
|
-
<CardText
|
|
176
|
-
className={cx('', {
|
|
177
|
-
'mb-3': topics?.length > 0,
|
|
178
|
-
})}
|
|
179
|
-
>
|
|
180
|
-
{listingText}
|
|
181
|
-
</CardText>
|
|
182
|
-
)}
|
|
183
|
-
<BlockExtraTags
|
|
184
|
-
{...props}
|
|
185
|
-
item={item}
|
|
186
|
-
itemIndex={index}
|
|
187
|
-
/>
|
|
188
|
-
{topics?.length > 0 && (
|
|
189
|
-
<div
|
|
190
|
-
className={cx('', {
|
|
191
|
-
'mb-3': eventRecurrenceMore,
|
|
192
|
-
})}
|
|
193
|
-
>
|
|
194
|
-
{topics.map((argument, index) => (
|
|
195
|
-
<UniversalLink
|
|
196
|
-
href={flattenToAppURL(argument['@id'])}
|
|
197
|
-
key={index}
|
|
198
|
-
title={argument.title}
|
|
199
|
-
className="text-decoration-none"
|
|
200
|
-
>
|
|
201
|
-
<Chip
|
|
202
|
-
color="primary"
|
|
203
|
-
disabled={false}
|
|
204
|
-
simple
|
|
205
|
-
tag="div"
|
|
206
|
-
className="me-2"
|
|
207
|
-
>
|
|
208
|
-
<ChipLabel tag="span">
|
|
209
|
-
{argument.title}
|
|
210
|
-
</ChipLabel>
|
|
211
|
-
</Chip>
|
|
212
|
-
</UniversalLink>
|
|
213
|
-
))}
|
|
214
|
-
</div>
|
|
215
|
-
)}
|
|
216
|
-
|
|
217
|
-
{eventRecurrenceMore}
|
|
218
|
-
</CardBody>
|
|
219
|
-
</Card>
|
|
220
|
-
)}
|
|
54
|
+
<CardWithImageDefault {...props} item={item} index={index} />
|
|
221
55
|
</Col>
|
|
222
56
|
);
|
|
223
57
|
})}
|
|
@@ -242,4 +76,4 @@ CardWithImageTemplate.propTypes = {
|
|
|
242
76
|
title: PropTypes.string,
|
|
243
77
|
};
|
|
244
78
|
|
|
245
|
-
export default
|
|
79
|
+
export default CardWithImageTemplate;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
2
|
-
|
|
3
1
|
export const getCategory = (item, show_type, show_section, props) => {
|
|
4
2
|
let cat = [];
|
|
5
3
|
|
|
@@ -17,71 +15,3 @@ export const getCategory = (item, show_type, show_section, props) => {
|
|
|
17
15
|
}
|
|
18
16
|
return null;
|
|
19
17
|
};
|
|
20
|
-
export const visibleSlideTitle = (selector) => {
|
|
21
|
-
// Needed to deal with react-slick duplicating a lot of slides
|
|
22
|
-
// when used in infinite mode. It's an useless and counterproductive
|
|
23
|
-
// thing to do on their part, there are multiple issues opened.
|
|
24
|
-
// The lib is not actually mantained so...
|
|
25
|
-
return Array.from(document.querySelectorAll(selector)).find((e) => {
|
|
26
|
-
const rect = e.getBoundingClientRect();
|
|
27
|
-
return rect.left >= 0 && rect.right <= window.innerWidth;
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const useSlider = (userAutoplay) => {
|
|
32
|
-
const slider = useRef(null);
|
|
33
|
-
const onIntersection = (entries, opt) => {
|
|
34
|
-
entries.forEach((entry) =>
|
|
35
|
-
entry.target.classList.toggle('visible', entry.isIntersecting),
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
const observer = new IntersectionObserver(onIntersection, {
|
|
39
|
-
root: null,
|
|
40
|
-
threshold: 0.5,
|
|
41
|
-
});
|
|
42
|
-
if (document.querySelector('.block.listing.slider'))
|
|
43
|
-
observer.observe(document.querySelector('.block.listing.slider'));
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
return () => observer.disconnect();
|
|
46
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
-
}, []);
|
|
48
|
-
|
|
49
|
-
const focusNext = (currentSlide) => {
|
|
50
|
-
const sliderElement = document.querySelector('.block.listing.slider');
|
|
51
|
-
if (!sliderElement) return;
|
|
52
|
-
const sliderIsVisible = sliderElement.classList.contains('visible');
|
|
53
|
-
|
|
54
|
-
if (!sliderIsVisible) {
|
|
55
|
-
slider.current.slickPause();
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const slide = sliderElement.querySelectorAll(
|
|
59
|
-
`a.slide-link[data-slide="${currentSlide}"]`,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
if ((userAutoplay && !slide) || (userAutoplay && !slide.length > 0)) return;
|
|
63
|
-
|
|
64
|
-
// Custom handling of focus for a11y
|
|
65
|
-
const link = visibleSlideTitle(
|
|
66
|
-
`a.slide-link[data-slide="${currentSlide}"]`,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
if (!link || document.activeElement === link) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
// eslint-disable-next-line no-unused-expressions
|
|
73
|
-
else if (
|
|
74
|
-
// if the focus was already on a slide, move it to the current one
|
|
75
|
-
Array.from(document.querySelectorAll('.slick-slide')).some((el) =>
|
|
76
|
-
el.contains(document.activeElement),
|
|
77
|
-
)
|
|
78
|
-
) {
|
|
79
|
-
link.focus();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
slider,
|
|
85
|
-
focusNext,
|
|
86
|
-
};
|
|
87
|
-
};
|