design-comuni-plone-theme 10.3.0 → 10.4.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/RELEASE.md +13 -0
  3. package/locales/de/LC_MESSAGES/volto.po +23 -22
  4. package/locales/en/LC_MESSAGES/volto.po +23 -22
  5. package/locales/es/LC_MESSAGES/volto.po +23 -22
  6. package/locales/fr/LC_MESSAGES/volto.po +23 -22
  7. package/locales/it/LC_MESSAGES/volto.po +23 -22
  8. package/locales/volto.pot +24 -23
  9. package/package.json +1 -1
  10. package/publiccode.yml +2 -2
  11. package/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +9 -5
  12. package/src/components/ItaliaTheme/Blocks/Alert/Sidebar.jsx +51 -76
  13. package/src/components/ItaliaTheme/Blocks/Alert/View.jsx +4 -2
  14. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +1 -0
  15. package/src/components/ItaliaTheme/Blocks/__tests__/Alert.test.jsx +1 -1
  16. package/src/components/ItaliaTheme/GalleryPreview/GalleryPreview.jsx +11 -24
  17. package/src/components/ItaliaTheme/Header/ParentSiteMenu.jsx +2 -1
  18. package/src/components/ItaliaTheme/Icons/FontAwesomeIcon.jsx +42 -20
  19. package/src/components/ItaliaTheme/View/BandoView/BandoText.jsx +7 -37
  20. package/src/components/ItaliaTheme/View/BandoView/BandoTextDestinatari.jsx +36 -0
  21. package/src/components/ItaliaTheme/View/BandoView/BandoTextEnte.jsx +34 -0
  22. package/src/components/ItaliaTheme/View/BandoView/BandoTextTipologia.jsx +32 -0
  23. package/src/components/ItaliaTheme/View/Commons/SearchSectionForm.jsx +24 -3
  24. package/src/components/ItaliaTheme/View/VenueView/VenueDescription.jsx +9 -65
  25. package/src/components/ItaliaTheme/View/VenueView/VenueElementiDiInteresse.jsx +26 -0
  26. package/src/components/ItaliaTheme/View/VenueView/VenueLuoghiCorrelati.jsx +37 -0
  27. package/src/components/ItaliaTheme/View/VenueView/VenueMultimedia.jsx +25 -0
  28. package/src/components/ItaliaTheme/View/VenueView/VenueTipologia.jsx +27 -0
  29. package/src/components/ItaliaTheme/View/index.js +4 -0
  30. package/src/components/ItaliaTheme/manage/Widgets/IconPreviewWidget.jsx +1 -1
  31. package/src/theme/ItaliaTheme/Blocks/_alert.scss +26 -65
  32. package/src/theme/ItaliaTheme/Components/_galleryPreview.scss +9 -13
  33. package/src/theme/ItaliaTheme/Subsites/_common.scss +0 -1
  34. package/src/theme/ItaliaTheme/Views/_common.scss +10 -0
  35. package/src/theme/ItaliaTheme/_home.scss +10 -0
  36. package/src/theme/_cms-ui.scss +14 -0
  37. package/src/theme/_site-variables.scss +5 -0
  38. package/src/theme/ItaliaTheme/Subsites/_homepage.scss +0 -9
package/locales/volto.pot CHANGED
@@ -1,7 +1,7 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Plone\n"
4
- "POT-Creation-Date: 2023-11-07T09:01:50.705Z\n"
4
+ "POT-Creation-Date: 2023-11-14T17:26:17.874Z\n"
5
5
  "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
6
  "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
7
  "MIME-Version: 1.0\n"
@@ -73,6 +73,7 @@ msgstr ""
73
73
  msgid "CardImageRight"
74
74
  msgstr ""
75
75
 
76
+ #: components/ItaliaTheme/Blocks/Alert/Sidebar
76
77
  #: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar
77
78
  # defaultMessage: Dimensione immagine
78
79
  msgid "CardImageSize"
@@ -120,21 +121,6 @@ msgstr ""
120
121
  msgid "Color"
121
122
  msgstr ""
122
123
 
123
- #: components/ItaliaTheme/Blocks/Alert/Sidebar
124
- # defaultMessage: Rosso
125
- msgid "Color_danger"
126
- msgstr ""
127
-
128
- #: components/ItaliaTheme/Blocks/Alert/Sidebar
129
- # defaultMessage: Giallo
130
- msgid "Color_warning"
131
- msgstr ""
132
-
133
- #: components/ItaliaTheme/Blocks/Alert/Sidebar
134
- # defaultMessage: Arancione
135
- msgid "Color_warning_orange"
136
- msgstr ""
137
-
138
124
  #: components/ItaliaTheme/View/EventoView/EventoContatti
139
125
  # defaultMessage: Contatti
140
126
  msgid "Contatti"
@@ -698,7 +684,7 @@ msgstr ""
698
684
  msgid "VenuesSmall"
699
685
  msgstr ""
700
686
 
701
- #: components/ItaliaTheme/View/VenueView/VenueDescription
687
+ #: components/ItaliaTheme/View/VenueView/VenueMultimedia
702
688
  # defaultMessage: Video
703
689
  msgid "Video"
704
690
  msgstr ""
@@ -1008,7 +994,7 @@ msgstr ""
1008
994
  msgid "bando_data_pubblicazione"
1009
995
  msgstr ""
1010
996
 
1011
- #: components/ItaliaTheme/View/BandoView/BandoText
997
+ #: components/ItaliaTheme/View/BandoView/BandoTextDestinatari
1012
998
  # defaultMessage: Destinatari del bando
1013
999
  msgid "bando_destinatari"
1014
1000
  msgstr ""
@@ -1019,7 +1005,7 @@ msgid "bando_effective"
1019
1005
  msgstr ""
1020
1006
 
1021
1007
  #: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
1022
- #: components/ItaliaTheme/View/BandoView/BandoText
1008
+ #: components/ItaliaTheme/View/BandoView/BandoTextEnte
1023
1009
  # defaultMessage: Ente
1024
1010
  msgid "bando_ente"
1025
1011
  msgstr ""
@@ -1204,6 +1190,16 @@ msgstr ""
1204
1190
  msgid "codice_ipa"
1205
1191
  msgstr ""
1206
1192
 
1193
+ #: components/ItaliaTheme/Blocks/Alert/Sidebar
1194
+ # defaultMessage: Rosso
1195
+ msgid "color_danger"
1196
+ msgstr ""
1197
+
1198
+ #: components/ItaliaTheme/Blocks/Alert/Sidebar
1199
+ # defaultMessage: Arancione
1200
+ msgid "color_orange"
1201
+ msgstr ""
1202
+
1207
1203
  #: components/ItaliaTheme/Blocks/ContactsBlock/Sidebar
1208
1204
  #: components/ItaliaTheme/Blocks/HighlightedContent/Sidebar
1209
1205
  # defaultMessage: Primario
@@ -1215,6 +1211,11 @@ msgstr ""
1215
1211
  msgid "color_transparent"
1216
1212
  msgstr ""
1217
1213
 
1214
+ #: components/ItaliaTheme/Blocks/Alert/Sidebar
1215
+ # defaultMessage: Giallo
1216
+ msgid "color_warning"
1217
+ msgstr ""
1218
+
1218
1219
  #: components/ItaliaTheme/View/IncaricoView/IncaricoView
1219
1220
  #: components/ItaliaTheme/View/PersonaView/PersonaDocumenti
1220
1221
  #: components/ItaliaTheme/View/PersonaView/PersonaRuolo
@@ -1799,7 +1800,7 @@ msgstr ""
1799
1800
  msgid "edit_social_links"
1800
1801
  msgstr ""
1801
1802
 
1802
- #: components/ItaliaTheme/View/VenueView/VenueDescription
1803
+ #: components/ItaliaTheme/View/VenueView/VenueElementiDiInteresse
1803
1804
  # defaultMessage: Elementi di interesse
1804
1805
  msgid "elementi_di_interesse"
1805
1806
  msgstr ""
@@ -2355,7 +2356,7 @@ msgid "logo-subsite-alt"
2355
2356
  msgstr ""
2356
2357
 
2357
2358
  #: components/ItaliaTheme/View/PuntoDiContattoView/RelatedItemsChipsPDC
2358
- #: components/ItaliaTheme/View/VenueView/VenueDescription
2359
+ #: components/ItaliaTheme/View/VenueView/VenueLuoghiCorrelati
2359
2360
  # defaultMessage: Luoghi correlati
2360
2361
  msgid "luoghi_correlati"
2361
2362
  msgstr ""
@@ -3736,7 +3737,7 @@ msgstr ""
3736
3737
  msgid "timeline_tempi_scadenze_validation_error"
3737
3738
  msgstr ""
3738
3739
 
3739
- #: components/ItaliaTheme/View/BandoView/BandoText
3740
+ #: components/ItaliaTheme/View/BandoView/BandoTextTipologia
3740
3741
  # defaultMessage: Tipologia del bando
3741
3742
  msgid "tipologia_bando"
3742
3743
  msgstr ""
@@ -3747,7 +3748,7 @@ msgstr ""
3747
3748
  msgid "tipologia_incarico"
3748
3749
  msgstr ""
3749
3750
 
3750
- #: components/ItaliaTheme/View/VenueView/VenueDescription
3751
+ #: components/ItaliaTheme/View/VenueView/VenueTipologia
3751
3752
  # defaultMessage: Tipo di luogo
3752
3753
  msgid "tipologia_luogo"
3753
3754
  msgstr ""
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "design-comuni-plone-theme",
3
3
  "description": "Volto Theme for Italia design guidelines",
4
4
  "license": "GPL-v3",
5
- "version": "10.3.0",
5
+ "version": "10.4.0",
6
6
  "main": "src/index.js",
7
7
  "keywords": [
8
8
  "volto-addon",
package/publiccode.yml CHANGED
@@ -227,9 +227,9 @@ maintenance:
227
227
  name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
228
228
  platforms:
229
229
  - web
230
- releaseDate: '2023-11-07'
230
+ releaseDate: '2023-11-14'
231
231
  softwareType: standalone/web
232
- softwareVersion: 10.3.0
232
+ softwareVersion: 10.4.0
233
233
  url: 'https://github.com/italia/design-comuni-plone-theme'
234
234
  usedBy:
235
235
  - ASP Comuni Modenesi Area Nord
@@ -59,8 +59,8 @@ class Edit extends Component {
59
59
 
60
60
  constructor(props) {
61
61
  super(props);
62
- if (!this.props.data.color) {
63
- this.props.data.color = 'warning';
62
+ if (!this.props.data.bg_color) {
63
+ this.props.data.bg_color = 'warning';
64
64
  }
65
65
  this.blockNode = React.createRef();
66
66
  }
@@ -78,8 +78,8 @@ class Edit extends Component {
78
78
  >
79
79
  <Row
80
80
  className={cx(
81
- 'row-full-width p-5',
82
- 'bg-alert-' + this.props.data.color,
81
+ 'full-width p-5',
82
+ 'bg-alert-' + this.props.data.bg_color,
83
83
  )}
84
84
  >
85
85
  <Container className="ui">
@@ -89,7 +89,11 @@ class Edit extends Component {
89
89
  <img
90
90
  src={`data:${this.props.data.image['content-type']};${this.props.data.image.encoding},${this.props.data.image.data}`}
91
91
  alt=""
92
- className="left-image"
92
+ className={cx('left-image', [
93
+ this.props.data.sizeImage
94
+ ? 'size-' + this.props.data.sizeImage
95
+ : 'size-l',
96
+ ])}
93
97
  />
94
98
  </Col>
95
99
  )}
@@ -1,31 +1,36 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Form } from 'semantic-ui-react';
4
- import { Button, Grid, Segment } from 'semantic-ui-react';
3
+ import { Segment } from 'semantic-ui-react';
5
4
  import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
6
5
  import { FileWidget } from '@plone/volto/components';
6
+ import { ColorListWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
7
+ import ImageSizeWidget from '@plone/volto/components/manage/Widgets/ImageSizeWidget';
7
8
 
8
9
  const messages = defineMessages({
9
10
  Color: {
10
11
  id: 'Color',
11
12
  defaultMessage: 'Colore',
12
13
  },
13
- Color_warning: {
14
- id: 'Color_warning',
14
+ color_warning: {
15
+ id: 'color_warning',
15
16
  defaultMessage: 'Giallo',
16
17
  },
17
- Color_warning_orange: {
18
- id: 'Color_warning_orange',
18
+ color_orange: {
19
+ id: 'color_orange',
19
20
  defaultMessage: 'Arancione',
20
21
  },
21
- Color_danger: {
22
- id: 'Color_danger',
22
+ color_danger: {
23
+ id: 'color_danger',
23
24
  defaultMessage: 'Rosso',
24
25
  },
25
26
  Image: {
26
27
  id: 'Image',
27
28
  defaultMessage: 'Immagine',
28
29
  },
30
+ CardImageSize: {
31
+ id: 'CardImageSize',
32
+ defaultMessage: 'Dimensione immagine',
33
+ },
29
34
  });
30
35
 
31
36
  class Sidebar extends Component {
@@ -37,6 +42,21 @@ class Sidebar extends Component {
37
42
  };
38
43
 
39
44
  render() {
45
+ const bg_colors = [
46
+ {
47
+ name: 'info',
48
+ label: this.props.intl.formatMessage(messages.color_warning),
49
+ },
50
+ {
51
+ name: 'warning',
52
+ label: this.props.intl.formatMessage(messages.color_orange),
53
+ },
54
+ {
55
+ name: 'danger',
56
+ label: this.props.intl.formatMessage(messages.color_danger),
57
+ },
58
+ ];
59
+
40
60
  return (
41
61
  <Segment.Group raised>
42
62
  <header className="header pulled">
@@ -46,74 +66,18 @@ class Sidebar extends Component {
46
66
  </header>
47
67
 
48
68
  <Segment className="form">
49
- <Form.Field inline required={this.props.required}>
50
- <Grid>
51
- <Grid.Row>
52
- <Grid.Column width="4">
53
- <div className="wrapper">
54
- <label htmlFor="field-align">
55
- {this.props.intl.formatMessage(messages.Color)}
56
- </label>
57
- </div>
58
- </Grid.Column>
59
- <Grid.Column
60
- width="8"
61
- verticalAlign="middle"
62
- className="color-chooser"
63
- >
64
- <Button.Group vertical compact>
65
- <Button
66
- icon
67
- basic={this.props.data.color !== 'warning'}
68
- color="yellow"
69
- onClick={(name, value) => {
70
- this.props.onChangeBlock(this.props.block, {
71
- ...this.props.data,
72
- color: 'warning',
73
- });
74
- }}
75
- active={this.props.data.color === 'warning'}
76
- content={this.props.intl.formatMessage(
77
- messages.Color_warning,
78
- )}
79
- />
80
-
81
- <Button
82
- icon
83
- basic={this.props.data.color !== 'warning-orange'}
84
- color="orange"
85
- onClick={(name, value) => {
86
- this.props.onChangeBlock(this.props.block, {
87
- ...this.props.data,
88
- color: 'warning-orange',
89
- });
90
- }}
91
- active={this.props.data.color === 'warning-orange'}
92
- content={this.props.intl.formatMessage(
93
- messages.Color_warning_orange,
94
- )}
95
- />
96
-
97
- <Button
98
- icon
99
- basic={this.props.data.color !== 'danger'}
100
- color="red"
101
- onClick={(name, value) => {
102
- this.props.onChangeBlock(this.props.block, {
103
- ...this.props.data,
104
- color: 'danger',
105
- });
106
- }}
107
- active={this.props.data.color === 'danger'}
108
- content={this.props.intl.formatMessage(
109
- messages.Color_danger,
110
- )}
111
- />
112
- </Button.Group>
113
- </Grid.Column>
114
- </Grid.Row>
115
- </Grid>
116
- </Form.Field>
69
+ <ColorListWidget
70
+ id="bg_color"
71
+ title={this.props.intl.formatMessage(messages.Color)}
72
+ value={this.props.data.bg_color}
73
+ onChange={(id, value) => {
74
+ this.props.onChangeBlock(this.props.block, {
75
+ ...this.props.data,
76
+ [id]: value,
77
+ });
78
+ }}
79
+ colors={bg_colors}
80
+ />
117
81
  <FileWidget
118
82
  id="image"
119
83
  title={this.props.intl.formatMessage(messages.Image)}
@@ -125,6 +89,17 @@ class Sidebar extends Component {
125
89
  });
126
90
  }}
127
91
  />
92
+ <ImageSizeWidget
93
+ id="sizeImage"
94
+ title={this.props.intl.formatMessage(messages.CardImageSize)}
95
+ onChange={(name, value) => {
96
+ this.props.onChangeBlock(this.props.block, {
97
+ ...this.props.data,
98
+ sizeImage: value,
99
+ });
100
+ }}
101
+ value={this.props.data.sizeImage}
102
+ />
128
103
  </Segment>
129
104
  </Segment.Group>
130
105
  );
@@ -29,7 +29,7 @@ const View = ({ data, pathname }) => {
29
29
 
30
30
  return (
31
31
  <section role="alert" className="block alertblock">
32
- <div className={cx('full-width', 'bg-alert-' + data.color)}>
32
+ <div className={cx('full-width', 'bg-alert-' + data.bg_color)}>
33
33
  <Container className="p-4 pt-5 pb-5">
34
34
  <Row className="align-items-start">
35
35
  {data.image?.data && (
@@ -38,7 +38,9 @@ const View = ({ data, pathname }) => {
38
38
  src={`data:${data.image['content-type']};${data.image.encoding},${data.image.data}`}
39
39
  alt=""
40
40
  aria-hidden="true"
41
- className="left-image"
41
+ className={cx('left-image', [
42
+ data.sizeImage ? 'size-' + data.sizeImage : 'size-l',
43
+ ])}
42
44
  loading="lazy"
43
45
  />
44
46
  </Col>
@@ -49,6 +49,7 @@ class Edit extends SubblocksEdit {
49
49
  super(props);
50
50
  this.state.selectedField = 'title';
51
51
  }
52
+
52
53
  /**
53
54
  * Render method.
54
55
  * @method render
@@ -11,7 +11,7 @@ const mockStore = configureStore(middlewares);
11
11
 
12
12
  const mock_fields = {
13
13
  '@type': 'alert',
14
- color: 'warning',
14
+ bg_color: 'warning',
15
15
  image: {
16
16
  'content-type': 'image/jpeg',
17
17
  data:
@@ -1,11 +1,9 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl';
3
- import { flattenToAppURL } from '@plone/volto/helpers';
4
-
5
3
  import PropTypes from 'prop-types';
6
4
  import { Modal, ModalBody, Button, ModalHeader } from 'design-react-kit';
7
5
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
8
- import DefaultImageSVG from '@plone/volto/components/manage/Blocks/Listing/default-image.svg';
6
+ import Image from '@plone/volto/components/theme/Image/Image';
9
7
 
10
8
  const messages = defineMessages({
11
9
  view_prev: {
@@ -31,18 +29,10 @@ const messages = defineMessages({
31
29
  */
32
30
  const GalleryPreview = ({ id, viewIndex, setViewIndex, items }) => {
33
31
  const intl = useIntl();
32
+
34
33
  const [modalIsOpen, setModalIsOpen] = useState(false);
35
34
  const image = items[viewIndex];
36
35
 
37
- let checkUrlImage = image?.image_field
38
- ? image?.image_scales?.[image?.image_field]?.[0]?.scales?.larger?.download
39
- : image?.image?.scales?.larger?.download ||
40
- image?.image_scales?.image[0]?.scales?.larger?.download;
41
-
42
- if (checkUrlImage?.startsWith('@@')) {
43
- checkUrlImage = image['@id'] + '/' + checkUrlImage;
44
- }
45
-
46
36
  const closeModal = () => {
47
37
  setViewIndex(null);
48
38
  };
@@ -74,7 +64,6 @@ const GalleryPreview = ({ id, viewIndex, setViewIndex, items }) => {
74
64
  {viewIndex != null && (
75
65
  <>
76
66
  <ModalHeader
77
- closeButton={true}
78
67
  closeAriaLabel={intl.formatMessage(messages.close_preview)}
79
68
  toggle={closeModal}
80
69
  >
@@ -98,17 +87,15 @@ const GalleryPreview = ({ id, viewIndex, setViewIndex, items }) => {
98
87
  <Icon color="" icon="it-arrow-left" padding={false} />
99
88
  </Button>
100
89
  )}
101
- <div className="image">
102
- {checkUrlImage ? (
103
- <img
104
- src={flattenToAppURL(checkUrlImage)}
105
- loading="lazy"
106
- alt={image.title}
107
- />
108
- ) : (
109
- <img src={DefaultImageSVG} alt="" />
110
- )}
111
- </div>
90
+
91
+ {image && (
92
+ <Image
93
+ key={image['@id']}
94
+ itemUrl={image['@id']}
95
+ image={image['@id']}
96
+ alt={image.title}
97
+ />
98
+ )}
112
99
 
113
100
  {items.length > 1 && (
114
101
  <Button
@@ -27,7 +27,8 @@ const ParentSiteMenu = () => {
27
27
  // eslint-disable-next-line no-loop-func
28
28
  dropdownMenu.forEach((m) => {
29
29
  if (m.rootPath === s) {
30
- menu = m;
30
+ // Filter non visible dropdown menu entries
31
+ menu = { ...m, items: m.items.filter((mi) => mi.visible) };
31
32
  i = 0;
32
33
  }
33
34
  });
@@ -7,7 +7,11 @@ import { fontAwesomeAliases } from 'design-comuni-plone-theme/helpers/index';
7
7
 
8
8
  const FontAwesomeIcon = (props) => {
9
9
  const { className, icon, prefix, title } = props;
10
- const [loadedIcon, setLoadedIcon] = React.useState(null);
10
+ const [loadedIcon, setLoadedIcon] = React.useState({
11
+ module: null,
12
+ iconName: '',
13
+ family: 'solid',
14
+ });
11
15
 
12
16
  const getIconAlias = (icon, aliasList) => {
13
17
  if (icon in aliasList) {
@@ -17,40 +21,58 @@ const FontAwesomeIcon = (props) => {
17
21
  }
18
22
  };
19
23
 
20
- let prefixKey = prefix;
21
- let iconName = '';
22
-
23
- if (Array.isArray(icon)) {
24
- prefixKey = icon[0];
25
- iconName = getIconAlias(icon[1], fontAwesomeAliases);
26
- } else {
27
- iconName = getIconAlias(icon, fontAwesomeAliases);
28
- }
24
+ const getIconInfo = (icon, prefix) => {
25
+ let prefixKey = prefix;
26
+ let iconName = '';
27
+ if (Array.isArray(icon)) {
28
+ prefixKey = icon[0];
29
+ iconName = getIconAlias(icon[1], fontAwesomeAliases);
30
+ } else {
31
+ iconName = getIconAlias(icon, fontAwesomeAliases);
32
+ }
29
33
 
30
- const prefixFolder =
31
- prefixKey === 'fab' ? 'brands' : prefixKey === 'far' ? 'regular' : 'solid';
34
+ return [
35
+ prefixKey === 'fab'
36
+ ? 'brands'
37
+ : prefixKey === 'far'
38
+ ? 'regular'
39
+ : 'solid',
40
+ iconName,
41
+ ];
42
+ };
32
43
 
33
44
  React.useEffect(() => {
34
- if (iconName && !loadedIcon) {
45
+ const [prefixFolder, iconName] = getIconInfo(icon, prefix);
46
+ if (
47
+ iconName &&
48
+ (iconName !== loadedIcon.iconName || prefixFolder !== loadedIcon.family)
49
+ ) {
35
50
  import(
36
51
  `design-comuni-plone-theme/icons/fontawesome-free-6.4.0-web/svgs/${prefixFolder}/${iconName}.svg`
37
52
  )
38
53
  .then((_loadedIcon) => {
39
- setLoadedIcon(_loadedIcon);
54
+ setLoadedIcon({
55
+ module: _loadedIcon.default,
56
+ iconName,
57
+ family: prefixFolder,
58
+ });
40
59
  })
41
60
  .catch((error) => {});
42
61
  }
43
- }, [iconName, loadedIcon, prefixFolder]);
62
+ // eslint-disable-next-line react-hooks/exhaustive-deps
63
+ }, [icon, prefix, loadedIcon]);
44
64
 
45
- return loadedIcon ? (
65
+ return loadedIcon.module ? (
46
66
  <svg
47
- xmlns={loadedIcon.attributes && loadedIcon.attributes.xmlns}
48
- viewBox={loadedIcon.attributes && loadedIcon.attributes.viewBox}
67
+ xmlns={loadedIcon.module.attributes && loadedIcon.module.attributes.xmlns}
68
+ viewBox={
69
+ loadedIcon.module.attributes && loadedIcon.module.attributes.viewBox
70
+ }
49
71
  className={`icon fa-icon ${className ?? ''}`}
50
72
  dangerouslySetInnerHTML={{
51
73
  __html: title
52
- ? `<title>${title}</title>${loadedIcon.content}`
53
- : loadedIcon.content,
74
+ ? `<title>${title}</title>${loadedIcon.module.content}`
75
+ : loadedIcon.module.content,
54
76
  }}
55
77
  />
56
78
  ) : icon ? (
@@ -7,23 +7,15 @@ import {
7
7
  richTextHasContent,
8
8
  } from 'design-comuni-plone-theme/components/ItaliaTheme/View';
9
9
 
10
+ import BandoTextTipologia from 'design-comuni-plone-theme/components/ItaliaTheme/View/BandoView/BandoTextTipologia';
11
+ import BandoTextDestinatari from 'design-comuni-plone-theme/components/ItaliaTheme/View/BandoView/BandoTextDestinatari';
12
+ import BandoTextEnte from 'design-comuni-plone-theme/components/ItaliaTheme/View/BandoView/BandoTextEnte';
13
+
10
14
  const messages = defineMessages({
11
15
  descrizione: {
12
16
  id: 'descrizione_bando',
13
17
  defaultMessage: 'Descrizione',
14
18
  },
15
- tipologia_bando: {
16
- id: 'tipologia_bando',
17
- defaultMessage: 'Tipologia del bando',
18
- },
19
- destinatari: {
20
- id: 'bando_destinatari',
21
- defaultMessage: 'Destinatari del bando',
22
- },
23
- ente: {
24
- id: 'bando_ente',
25
- defaultMessage: 'Ente erogatore',
26
- },
27
19
  });
28
20
 
29
21
  const BandoText = ({ content }) => {
@@ -40,33 +32,11 @@ const BandoText = ({ content }) => {
40
32
  {/* DESCRIZIONE DEL BANDO */}
41
33
  {richTextHasContent(content?.text) && <RichText data={content?.text} />}
42
34
  {/* TIPOLOGIA DEL BANDO */}
43
- {content?.tipologia_bando && (
44
- <>
45
- <h3 className="h5">{intl.formatMessage(messages.tipologia_bando)}</h3>
46
- <span>{content.tipologia_bando.title}</span>
47
- </>
48
- )}
35
+ <BandoTextTipologia content={content} />
49
36
  {/* DESTINATARI DEL BANDO */}
50
- {content?.destinatari?.length > 0 && (
51
- <>
52
- <h3 className="h5">{intl.formatMessage(messages.destinatari)}</h3>
53
- {content.destinatari.map((item, i) => (
54
- <p key={'destinatari-' + i}>{item.title}</p>
55
- ))}
56
- </>
57
- )}
37
+ <BandoTextDestinatari content={content} />
58
38
  {/* ENTE DEL BANDO */}
59
- {content?.ente_bando?.length > 0 && (
60
- <>
61
- <h3 className="h5">{intl.formatMessage(messages.ente)}</h3>
62
- {content.ente_bando.map((item, i) => (
63
- <span key={'ente_' + i}>
64
- {item}
65
- {i < content.ente_bando.length - 1 ? ', ' : ''}
66
- </span>
67
- ))}
68
- </>
69
- )}
39
+ <BandoTextEnte content={content} />
70
40
  </RichTextSection>
71
41
  ) : (
72
42
  <></>
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { defineMessages, useIntl } from 'react-intl';
4
+
5
+ const messages = defineMessages({
6
+ destinatari: {
7
+ id: 'bando_destinatari',
8
+ defaultMessage: 'Destinatari del bando',
9
+ },
10
+ });
11
+
12
+ const BandoTextDestinatari = ({ content }) => {
13
+ const intl = useIntl();
14
+ return content?.destinatari?.length > 0 ? (
15
+ <>
16
+ <h3 className="h5">{intl.formatMessage(messages.destinatari)}</h3>
17
+ {content.destinatari.map((item, i) => (
18
+ <p key={'destinatari-' + i}>{item.title}</p>
19
+ ))}
20
+ </>
21
+ ) : (
22
+ <></>
23
+ );
24
+ };
25
+
26
+ BandoTextDestinatari.propTypes = {
27
+ content: PropTypes.shape({
28
+ destinatari: PropTypes.arrayOf(
29
+ PropTypes.shape({
30
+ title: PropTypes.string,
31
+ token: PropTypes.string,
32
+ }),
33
+ ),
34
+ }).isRequired,
35
+ };
36
+ export default BandoTextDestinatari;