Skip to content

Commit

Permalink
Add vertical align to columns
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Oct 9, 2020
1 parent 1517b37 commit 4190788
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ColumnsBlock/ColumnsBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class ColumnsBlockEdit extends React.Component {
className="block-column"
key={colId}
{...(gridSizes[gridCols[index]] || gridCols[index])}
style={getStyle(data?.data?.blocks?.[colId]?.settings || {})}
{...getStyle(data?.data?.blocks?.[colId]?.settings || {})}
>
<div className="column-header"></div>
<BlocksForm
Expand Down
9 changes: 2 additions & 7 deletions src/ColumnsBlock/ColumnsBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ import { getStyle } from '@eeacms/volto-columns-block/Styles';

const ColumnsBlockView = (props) => {
const { gridSizes } = blocks.blocksConfig[COLUMNSBLOCK];
const {
data = {},
gridSize = 12,
gridCols = [],
block_title,
} = props.data;
const { data = {}, gridSize = 12, gridCols = [], block_title } = props.data;
const metadata = props.metadata || props.properties;
const columnList = getColumns(data);
return (
Expand All @@ -27,7 +22,7 @@ const ColumnsBlockView = (props) => {
key={id}
{...(gridSizes[gridCols[index]] || gridCols[index])}
className="column-blocks-wrapper"
style={getStyle(column.settings || {})}
{...getStyle(column.settings || {})}
>
{/* <h4>{`Column ${index}`}</h4> */}
<RenderBlocks {...props} metadata={metadata} content={column} />
Expand Down
5 changes: 4 additions & 1 deletion src/Styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export function makeStyleSchema({ available_colors }) {

export function getStyle(props) {
return {
backgroundColor: props.backgroundColor,
verticalAlign: props.grid_vertical_align,
style: {
backgroundColor: props.backgroundColor,
},
};
}
10 changes: 9 additions & 1 deletion src/Styles/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const StyleSchema = () => ({
{
id: 'default',
title: 'Style',
fields: ['backgroundColor'],
fields: ['backgroundColor', 'grid_vertical_align'],
},
],
properties: {
Expand All @@ -13,6 +13,14 @@ export const StyleSchema = () => ({
type: 'color',
widget: 'simple_color_picker',
},
grid_vertical_align: {
title: 'Vertical align',
choices: [
['bottom', 'Bottom'],
['middle', 'Middle'],
['top', 'Top'],
],
},
},
required: [],
});
Expand Down

0 comments on commit 4190788

Please sign in to comment.