Skip to content
Permalink
Browse files

Add containers information to columns

  • Loading branch information...
fmontes committed Feb 26, 2019
1 parent 63bd89c commit 459b90accb9d4951b386809b6646f16056d9b68a
Showing with 22 additions and 2 deletions.
  1. +4 −2 src/components/Page.js
  2. +18 −0 src/utils/index.js
@@ -1,11 +1,13 @@
import React from 'react';
import Row from './Row';
import { getUpdatedColumns } from '../utils'

const Page = props => {
const { layout } = props;
const { layout, containers } = props;
return layout
? layout.body.rows.map(row => {
return <Row key={row.identifier} />;
const columns = getUpdatedColumns(row.columns, containers);
return <Row key={row.identifier} columns={columns} />;
})
: null;
};
@@ -0,0 +1,18 @@
function getFullContainers(column, containers) {
return column.containers.map(container => {
const fullContainer = containers[container.identifier];
return {
...fullContainer.container,
contentlets: fullContainer.contentlets
};
});
};

export function getUpdatedColumns(columns, containers) {
return columns.map(column => {
return {
...column,
containers: getFullContainers(column, containers)
};
});
};

0 comments on commit 459b90a

Please sign in to comment.
You can’t perform that action at this time.