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 EventoVView Contatti in different components
- Loading branch information
1 parent
561eec9
commit 5abf0d8
Showing
4 changed files
with
137 additions
and
73 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
55 changes: 55 additions & 0 deletions
55
src/components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreEsterno.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,55 @@ | ||
import PropTypes from 'prop-types'; | ||
import { Card, CardBody } from 'design-react-kit'; | ||
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme'; | ||
import { | ||
RichText, | ||
richTextHasContent, | ||
ContactLink, | ||
} from 'design-comuni-plone-theme/components/ItaliaTheme/View'; | ||
|
||
const EventoContattiOrganizzatoreEsterno = ({ content }) => { | ||
return richTextHasContent(content?.organizzato_da_esterno) || | ||
content?.telefono || | ||
content?.email || | ||
content?.fax ? ( | ||
<div className="mb-5"> | ||
<Card | ||
className="card card-teaser rounded shadow mt-3" | ||
noWrapper={true} | ||
tag="div" | ||
> | ||
<Icon icon="it-telephone" /> | ||
|
||
<CardBody tag="div" className={'card-body pe-3'}> | ||
<RichText data={content.organizzato_da_esterno} /> | ||
{content?.telefono && ( | ||
<p className="card-text mt-3"> | ||
<ContactLink tel={content.telefono} label={true} /> | ||
</p> | ||
)} | ||
{content?.fax && ( | ||
<p className="card-text mt-3"> | ||
<ContactLink fax={content.fax} label={true} /> | ||
</p> | ||
)} | ||
{content?.reperibilita?.replace(/(<([^>]+)>)/g, '').length > 0 && ( | ||
<p className="card-text mt-3"> | ||
{content?.reperibilita?.replace(/(<([^>]+)>)/g, '')} | ||
</p> | ||
)} | ||
{content?.email && ( | ||
<p className="card-text mt-3"> | ||
<ContactLink email={content.email} label={true} /> | ||
</p> | ||
)} | ||
</CardBody> | ||
</Card> | ||
</div> | ||
) : null; | ||
}; | ||
|
||
EventoContattiOrganizzatoreEsterno.propTypes = { | ||
content: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default EventoContattiOrganizzatoreEsterno; |
43 changes: 43 additions & 0 deletions
43
src/components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreInterno.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,43 @@ | ||
import PropTypes from 'prop-types'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
import { | ||
richTextHasContent, | ||
OfficeCard, | ||
} from 'design-comuni-plone-theme/components/ItaliaTheme/View'; | ||
|
||
const messages = defineMessages({ | ||
organizzato_da: { | ||
id: 'organizzato_da', | ||
defaultMessage: 'Organizzato da', | ||
}, | ||
}); | ||
|
||
const EventoContattiOrganizzatoreInterno = ({ content }) => { | ||
const intl = useIntl(); | ||
|
||
return content?.organizzato_da_interno?.length > 0 ? ( | ||
<div className="mb-5"> | ||
<h3 className="h5">{intl.formatMessage(messages.organizzato_da)}</h3> | ||
{content?.organizzato_da_interno?.map((item, index) => ( | ||
<OfficeCard | ||
margin_bottom={index < content?.organizzato_da_interno?.length - 1} | ||
key={item['@id']} | ||
office={item} | ||
icon={'it-telephone'} | ||
> | ||
{richTextHasContent(content?.contatto_reperibilita) && ( | ||
<p className="card-text mt-3"> | ||
{content?.contatto_reperibilita?.replace(/(<([^>]+)>)/g, '')} | ||
</p> | ||
)} | ||
</OfficeCard> | ||
))} | ||
</div> | ||
) : null; | ||
}; | ||
|
||
EventoContattiOrganizzatoreInterno.propTypes = { | ||
content: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default EventoContattiOrganizzatoreInterno; |
31 changes: 31 additions & 0 deletions
31
src/components/ItaliaTheme/View/EventoView/EventoContattiSupportatoDa.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,31 @@ | ||
import PropTypes from 'prop-types'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
import { OfficeCard } from 'design-comuni-plone-theme/components/ItaliaTheme/View'; | ||
|
||
const messages = defineMessages({ | ||
supported_by: { | ||
id: 'supported_by', | ||
defaultMessage: 'Con il supporto di', | ||
}, | ||
}); | ||
|
||
const EventoContattiSupportatoDa = ({ content }) => { | ||
const intl = useIntl(); | ||
|
||
return content?.supportato_da?.length > 0 ? ( | ||
<div className="mb-5"> | ||
<h3 className="mt-4 supported-by h5"> | ||
{intl.formatMessage(messages.supported_by)} | ||
</h3> | ||
{content?.supportato_da?.map((item) => ( | ||
<OfficeCard key={item['@id']} office={item} icon={'it-pa'} /> | ||
))} | ||
</div> | ||
) : null; | ||
}; | ||
|
||
EventoContattiSupportatoDa.propTypes = { | ||
content: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default EventoContattiSupportatoDa; |