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.
* feat: new custom layout fileview * fix: unused files removed * chore: design-react-kit component added and semantix-ui removed
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
src/customizations/volto/components/theme/View/FileView.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,64 @@ | ||
/** | ||
* File view component. | ||
* @module components/theme/View/FileView | ||
* - changed card layout | ||
*/ | ||
|
||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Container, Row, Col } from 'design-react-kit/dist/design-react-kit'; | ||
import { DownloadFileFormat } from 'design-comuni-plone-theme/components/ItaliaTheme/View'; | ||
|
||
/** | ||
* File view component class. | ||
* @function FileView | ||
* @params {object} content Content object. | ||
* @returns {string} Markup of the component. | ||
*/ | ||
|
||
const FileView = ({ content }) => ( | ||
<Container className="view-wrapper px-4 my-4"> | ||
<Row className="header-row"> | ||
<Col> | ||
<h1 className="documentFirstHeading"> | ||
{content.title} | ||
{content.subtitle && ` - ${content.subtitle}`} | ||
</h1> | ||
{content.description && ( | ||
<p className="documentDescription">{content.description}</p> | ||
)} | ||
</Col> | ||
</Row> | ||
|
||
{content.file?.download && ( | ||
<Row className="content-row"> | ||
<Col className="card-wrapper card-teaser-wrapper"> | ||
<div className="genericcard card card-teaser shadow p-4 mt-3 rounded"> | ||
<div className="card-body"> | ||
<h5 className="card-title">{content.file.filename}</h5> | ||
<DownloadFileFormat file={content.file} iconSize="2x" /> | ||
</div> | ||
</div> | ||
</Col> | ||
</Row> | ||
)} | ||
</Container> | ||
); | ||
|
||
/** | ||
* Property types. | ||
* @property {Object} propTypes Property types. | ||
* @static | ||
*/ | ||
FileView.propTypes = { | ||
content: PropTypes.shape({ | ||
title: PropTypes.string, | ||
description: PropTypes.string, | ||
file: PropTypes.shape({ | ||
download: PropTypes.string, | ||
filename: PropTypes.string, | ||
}), | ||
}).isRequired, | ||
}; | ||
|
||
export default FileView; |