forked from italia/design-comuni-plone-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: split BandoView Text in different components (#391)
* chore: split BandoView Text in different components * fix: restored propTypes in BandoText
- Loading branch information
1 parent
ba25d47
commit e787f38
Showing
10 changed files
with
128 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Plone\n" | ||
"POT-Creation-Date: 2023-11-07T09:01:50.705Z\n" | ||
"POT-Creation-Date: 2023-11-07T16:35:33.634Z\n" | ||
"Last-Translator: Plone i18n <[email protected]>\n" | ||
"Language-Team: Plone i18n <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
|
@@ -1008,7 +1008,7 @@ msgstr "" | |
msgid "bando_data_pubblicazione" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/View/BandoView/BandoText | ||
#: components/ItaliaTheme/View/BandoView/BandoTextDestinatari | ||
# defaultMessage: Destinatari del bando | ||
msgid "bando_destinatari" | ||
msgstr "" | ||
|
@@ -1019,7 +1019,7 @@ msgid "bando_effective" | |
msgstr "" | ||
|
||
#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate | ||
#: components/ItaliaTheme/View/BandoView/BandoText | ||
#: components/ItaliaTheme/View/BandoView/BandoTextEnte | ||
# defaultMessage: Ente | ||
msgid "bando_ente" | ||
msgstr "" | ||
|
@@ -3736,7 +3736,7 @@ msgstr "" | |
msgid "timeline_tempi_scadenze_validation_error" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/View/BandoView/BandoText | ||
#: components/ItaliaTheme/View/BandoView/BandoTextTipologia | ||
# defaultMessage: Tipologia del bando | ||
msgid "tipologia_bando" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/components/ItaliaTheme/View/BandoView/BandoTextDestinatari.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
|
||
const messages = defineMessages({ | ||
destinatari: { | ||
id: 'bando_destinatari', | ||
defaultMessage: 'Destinatari del bando', | ||
}, | ||
}); | ||
|
||
const BandoTextDestinatari = ({ content }) => { | ||
const intl = useIntl(); | ||
return content?.destinatari?.length > 0 ? ( | ||
<> | ||
<h3 className="h5">{intl.formatMessage(messages.destinatari)}</h3> | ||
{content.destinatari.map((item, i) => ( | ||
<p key={'destinatari-' + i}>{item.title}</p> | ||
))} | ||
</> | ||
) : ( | ||
<></> | ||
); | ||
}; | ||
|
||
BandoTextDestinatari.propTypes = { | ||
content: PropTypes.shape({ | ||
destinatari: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
title: PropTypes.string, | ||
token: PropTypes.string, | ||
}), | ||
), | ||
}).isRequired, | ||
}; | ||
export default BandoTextDestinatari; |
34 changes: 34 additions & 0 deletions
34
src/components/ItaliaTheme/View/BandoView/BandoTextEnte.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
|
||
const messages = defineMessages({ | ||
ente: { | ||
id: 'bando_ente', | ||
defaultMessage: 'Ente erogatore', | ||
}, | ||
}); | ||
|
||
const BandoTextEnte = ({ content }) => { | ||
const intl = useIntl(); | ||
return content?.ente_bando?.length > 0 ? ( | ||
<> | ||
<h3 className="h5">{intl.formatMessage(messages.ente)}</h3> | ||
{content.ente_bando.map((item, i) => ( | ||
<span key={'ente_' + i}> | ||
{item} | ||
{i < content.ente_bando.length - 1 ? ', ' : ''} | ||
</span> | ||
))} | ||
</> | ||
) : ( | ||
<></> | ||
); | ||
}; | ||
|
||
BandoTextEnte.propTypes = { | ||
content: PropTypes.shape({ | ||
ente_bando: PropTypes.arrayOf(PropTypes.string), | ||
}).isRequired, | ||
}; | ||
export default BandoTextEnte; |
32 changes: 32 additions & 0 deletions
32
src/components/ItaliaTheme/View/BandoView/BandoTextTipologia.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
|
||
const messages = defineMessages({ | ||
tipologia_bando: { | ||
id: 'tipologia_bando', | ||
defaultMessage: 'Tipologia del bando', | ||
}, | ||
}); | ||
|
||
const BandoTextTipologia = ({ content }) => { | ||
const intl = useIntl(); | ||
return content?.tipologia_bando ? ( | ||
<> | ||
<h3 className="h5">{intl.formatMessage(messages.tipologia_bando)}</h3> | ||
<span>{content.tipologia_bando.title}</span> | ||
</> | ||
) : ( | ||
<></> | ||
); | ||
}; | ||
|
||
BandoTextTipologia.propTypes = { | ||
content: PropTypes.shape({ | ||
tipologia_bando: PropTypes.shape({ | ||
title: PropTypes.string, | ||
token: PropTypes.string, | ||
}), | ||
}).isRequired, | ||
}; | ||
export default BandoTextTipologia; |