Skip to content

Commit

Permalink
Exercicio 19: altera a visao do tipo Secretaria
Browse files Browse the repository at this point in the history
  • Loading branch information
samoel-silva committed Sep 16, 2024
1 parent 3b80a7c commit 75903e1
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getBaseUrl } from '@plone/volto/helpers';
import { Container } from '@plone/components';
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';

const SecretariaView = (props) => {
const { content, location } = props;
const { telefone, email } = content;
const path = getBaseUrl(location?.pathname || '');

return (
<Container id="page-document" className="view-wrapper secretaria-view">
<RenderBlocks {...props} path={path} />
<Container className="contato">
<Container className="telefone">
<span>Telefone</span>: <span>{telefone}</span>
</Container>
<Container className="email">
<span>E-mail</span>: <a href={`mailto:${email}`}>{email}</a>
</Container>
</Container>
</Container>
);
};

/**
* Property types.
* @property {Object} propTypes Property types.
* @static
*/
SecretariaView.propTypes = {
content: PropTypes.shape({
title: PropTypes.string,
description: PropTypes.string,
email: PropTypes.string,
telefone: PropTypes.string,
}).isRequired,
};

export default SecretariaView;
8 changes: 8 additions & 0 deletions frontend/packages/volto-portal-governo/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
// Views
import SecretariaView from './components/Views/SecretariaView';

const applyConfig = (config) => {
config.settings = {
...config.settings,
isMultilingual: false,
supportedLanguages: ['pt-br'],
defaultLanguage: 'pt-br',
};
// Views
config.views.contentTypesViews = {
...config.views.contentTypesViews,
Secretaria: SecretariaView,
};
return config;
};

Expand Down

0 comments on commit 75903e1

Please sign in to comment.