Skip to content

Commit

Permalink
install grid layout, company header block
Browse files Browse the repository at this point in the history
  • Loading branch information
mihai-macaneata committed Jul 16, 2020
1 parent 915e8ae commit 5fbf979
Show file tree
Hide file tree
Showing 9 changed files with 1,372 additions and 971 deletions.
57 changes: 30 additions & 27 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
{
"addons": [
"volto-addons",
"volto-blocks",
"volto-ckeditor",
"volto-corsproxy",
"volto-datablocks",
"volto-drafteditor",
"volto-mosaic",
"volto-addons",
"volto-blocks",
"volto-ckeditor",
"volto-corsproxy",
"volto-datablocks",
"volto-drafteditor",
"volto-mosaic",
"volto-plotlycharts"
],
],
"compilerOptions": {
"baseUrl": "src",
"baseUrl": "src",
"paths": {
"volto-addons": [
"develop/volto-addons/src"
],
"volto-base": [
"develop/volto-base/src"
],
"volto-mosaic": [
"develop/volto-mosaic/src"
],
"volto-datablocks": [
"develop/volto-datablocks/src"
],
"volto-blocks": [
"develop/volto-blocks/src"
],
],
"volto-addons": [
"develop/volto-addons/src"
],
"volto-ckeditor": [
"develop/volto-ckeditor/src"
],
"volto-datablocks": [
"develop/volto-datablocks/src"
],
],
"volto-drafteditor": [
"develop/volto-drafteditor/src"
],
"volto-embed": [
"develop/volto-embed/src"
],
"volto-mosaic": [
"develop/volto-mosaic/src"
],
],
"volto-plotlycharts": [
"develop/volto-plotlycharts/src"
],
"volto-base": [
"develop/volto-base/src"
],
"volto-embed": [
"develop/volto-embed/src"
],
"volto-gridlayout": [
"develop/volto-gridlayout/src"
]
}
}
Expand Down
7 changes: 5 additions & 2 deletions mrs.developer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"volto-mosaic": {
"url": "https://github.com/eea/volto-mosaic.git",
"path": "src",
"branch": "blocks_override"
"path": "src"
},
"volto-datablocks": {
"url": "https://github.com/eea/volto-datablocks.git",
Expand Down Expand Up @@ -35,5 +34,9 @@
"volto-embed": {
"url": "https://github.com/eea/volto-embed.git",
"path": "src"
},
"volto-gridlayout": {
"url": "https://github.com/eea/volto-gridlayout.git",
"path": "src"
}
}
2,017 changes: 1,076 additions & 941 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@
"@blueprintjs/core": "^3.18.0",
"@blueprintjs/icons": "^3.10.0",
"@datapunt/matomo-tracker-react": "0.0.16",
"@plone/volto": "github:eea/volto#kitchen_sink",
"@plone/volto": "github:eea/volto#5.2-eea",
"http-server": "^0.12.1",
"immutable": "^3.8.2",
"less-loader": "5.0.0",
"lodash": "^4.17.15",
"npm": "^6.13.7",
"react": "^16.13.0",
"react-beautiful-dnd": "^13.0.0",
"react-component-queries": "^2.3.0",
"react-highlight-words": "^0.16.0",
"react-image-gallery": "^0.9.1",
Expand Down
44 changes: 44 additions & 0 deletions src/components/manage/Blocks/CompanyHeader/Edit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { useState, useEffect } from 'react';
import _uniqueId from 'lodash/uniqueId';
import DefaultEdit from '../DefaultEdit';
import View from './View';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { settings } from '~/config';

const schema = {
provider_url: {
title: 'Provider url',
type: 'text',
default: '',
},
sql_select: {
type: 'sql',
},
data_query: {
iTitle: 'Where column',
vTitle: 'Is equal to',
type: 'data-query',
},
};

const Edit = props => {
const [state] = useState({
id: _uniqueId('block_'),
});
useEffect(() => {
schema.provider_url.default = settings.providerUrl;
}, []);
return (
<div>
<DefaultEdit schema={schema} {...props} title="Facility block" />
<View {...props} id={state.id} />
</div>
);
};
export default compose(
connect((state, props) => ({
connected_data_parameters: state.connected_data_parameters,
pathname: state.router.location.pathname,
})),
)(Edit);
85 changes: 85 additions & 0 deletions src/components/manage/Blocks/CompanyHeader/View.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import React, { useState } from 'react';
import DB from '~/components/manage/DataBase/DB';

import DefaultView from '../DefaultView';

import moment from 'moment';
import './style.css';

// STATIC DATA
// ==================
const facility = {
companyName: 'Test company',
Address: 'Nord-Ovest, Lombardia, Brescia',
countryCode: 'IT',
'Site Inspire ID': '2',
Country: "Austria",
Regulation: 'regulatoryType',
Website: 'test-website.com',
riverBasin: 'RBD PADANO',
'Facility Main Activity':
'Thermal power stations and other combustion installations',
nationalId: '250452007.SITE',
OrganizationName: 'ISPRA',
ContactMail: 'protocollo.ispra@ispra.legalmail.it',
'Auth Address': 'ISPRA Via Vitaliano Brancati 48 Roma 00144',
ContactPerson: 'ISPRA',
authLastUpdated: '2018-05-15T06:37:00',
eprtrReportingDate: '2020-05-15T06:37:00',
eprtrReportingYear: 2020,
'Facility inspire ID': '2007000854',
};
const metadata = [
{ label: 'Name', id: 'companyName' },
{ label: 'Address', id: 'Address' },
{ label: 'Country', id: 'Country' },
{ label: 'Regulation', id: 'Regulation' },
{ label: 'Website', id: 'Website' },
];
// ==================

const View = props => {
const [state, setState] = useState({
onChange: newState => {
setState({ ...state, ...newState });
},
});
const view = (
<div className="facility-block-wrapper">
<div className="flex flex-row align-center space-between responsive">
<div className="flex flex-column">
<h1 className="mb-0 bold light-blue">{facility.companyName}</h1>
<p>{facility.mainActivity}</p>
</div>
</div>
<div className="mt-2 flex flex-row space-between responsive metadata">
{metadata.map(meta =>
facility[meta.id] ? (
<div>
<p className="bold mb-0">{meta.label}</p>
<p className="info dark">{facility[meta.id]}</p>
</div>
) : meta.default ? (
<div>
<p className="bold mb-0">{meta.label}</p>
<p className="info dark">{meta.default}</p>
</div>
) : (
''
),
)}
</div>
</div>
);
return view;
// return (
// <DefaultView
// {...props}
// schema={schema}
// view={view}
// onChange={state.onChange}
// />
// );
};

export default View;
116 changes: 116 additions & 0 deletions src/components/manage/Blocks/CompanyHeader/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/* DISPLAY */
.flex {
display: flex;
}
.grid {
display: grid;
grid-gap: 20px;
}
.display-block {
display: block;
}
/* GRID LAYOUT */
div.grid-cl-3 {
grid-template-columns: repeat(3, 1fr);
}
div.grid-cl-2 {
grid-template-columns: repeat(2, 1fr);
}
/* FLEX FLOW */
div.flex-row {
flex-flow: row;
}
div.flex-column {
flex-flow: column;
}
/* ALIGN ITEMS */
div.align-center {
align-items: center;
}
/* JUSTIFY CONTENT */
div.space-between {
justify-content: space-between;
}

div.banner {
background: #4296B2;
color: #fff;
padding: 0 1rem;
border-radius: 10px;
}

div.banner p {
color: #fff;
}

.light-blue {
color: #4296B2;
}

div.flex-item {
margin: 1rem;
}
/* PARAGRAPH */
p.bold {
font-weight: bold;
}
p.lighter {
font-weight: 300;
}
p.info {
color: #989898;
font-weight: 300;
font-size: 14px;
}
p.dark {
color: #333333;
}
/* MARGINS */
.mt-0 {
margin-top: 0;
}
.mt-1 {
margin-top: 1rem;
}
.mt-2 {
margin-top: 2rem;
}
.mb-0 {
margin-bottom: 0;
}
.mb-1 {
margin-bottom: 1rem;
}
.mb-2 {
margin-bottom: 2rem;
}

.bat-container {
border: 1px solid #606060;
padding: 16px;
border-radius: 10px;
box-sizing: border-box;
}

.bat-container div.hr {
height: 1px;
background-color: #606060;
}

.bat-container a,
.bat-container a:hover {
text-decoration: underline;
}

@media(max-width: 768px) {
div.responsive.flex {
flex-flow: column;
}
div.responsive.flex > * {
width: 100%;
margin-bottom: 26px;
}
div.responsive.grid.grid-cl-3 {
grid-template-columns: repeat(2, 1fr);
}
}
2 changes: 2 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { applyConfig as blocksConfig } from 'volto-blocks/config';
import { applyConfig as mosaicConfig } from 'volto-mosaic/config';
import { applyConfig as plotlyConfig } from 'volto-plotlycharts/config';
// import { applyConfig as installEPRTRFrontend } from './localconfig';
import { applyConfig as gridLayoutConfig } from 'volto-gridlayout/config';

// import { applyConfig as installEPRTRFrontend } from './localconfig';
import installEPRTR from './localconfig';
Expand All @@ -24,6 +25,7 @@ const config = [
mosaicConfig,
blocksConfig,
dataBlocksConfig,
gridLayoutConfig,
installEPRTR,
].reduce((acc, apply) => apply(acc), voltoConfig);

Expand Down
Loading

0 comments on commit 5fbf979

Please sign in to comment.