Skip to content

Commit

Permalink
Merge branch 'master' into undeletable-first-block
Browse files Browse the repository at this point in the history
  • Loading branch information
silviubogan committed Oct 9, 2020
2 parents 1bde90d + abf5158 commit bce150c
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/ColumnsBlock/ColumnVariations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export default ({ data, onChange, children, variants }) => {
return (
<Segment>
<h4>Select layout:</h4>
<Card.Group centered itemsPerRow={6}>
<Card.Group centered itemsPerRow={7}>
{variants.map(({ icon, defaultData, title }, index) => (
<Card key={index} onClick={() => onChange(defaultData)}>
<Card.Content>
<Icon name={icon} size="45" />
<Icon name={icon} size="55" />
{title ? <p>{title}</p> : ''}
</Card.Content>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion src/ColumnsBlock/ColumnsBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,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
3 changes: 3 additions & 0 deletions src/ColumnsBlock/icons/full-column.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 17 additions & 3 deletions src/ColumnsBlock/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
// }
}

.block-column .ui.block.inner {
.block {
margin-bottom: 0;
}
}

.column-grid {
margin-left: -0.2rem!important;
margin-right: -0.2rem!important;
Expand Down Expand Up @@ -107,10 +113,18 @@
margin-bottom: 8px;
position: absolute;
margin-top: -34px;
z-index: 10;
right: 0px;
z-index: 160;
left: 0px;

.wrapper-column-block {
> .ui.basic.button {
&:hover {
background-color: transparent!important;
}
}
}

.ui.basic.button {
>.ui.basic.button {
&:hover {
background-color: transparent!important;
}
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
3 changes: 2 additions & 1 deletion src/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import iconC from './ColumnsBlock/icons/one-third-right.svg';
import iconD from './ColumnsBlock/icons/three-third-columns.svg';
import iconE from './ColumnsBlock/icons/three-columns.svg';
import iconF from './ColumnsBlock/icons/four-quarter-columns.svg';
import iconG from './ColumnsBlock/icons/full-column.svg';

export const gridSizes = {
full: {
Expand Down Expand Up @@ -93,7 +94,7 @@ export const variants = [
title: '25 / 25 / 25 / 25',
},
{
icon: iconF,
icon: iconG,
defaultData: {
gridSize: 12,
gridCols: ['full'],
Expand Down

0 comments on commit bce150c

Please sign in to comment.