diff --git a/public/components/page_stack/index.js b/public/components/page_stack/index.js new file mode 100644 index 0000000000000..e62e06f543579 --- /dev/null +++ b/public/components/page_stack/index.js @@ -0,0 +1,4 @@ +import { pure } from 'recompose'; +import { PageStack as Component } from './page_stack'; + +export const PageStack = pure(Component); diff --git a/public/components/page_stack/page.less b/public/components/page_stack/page.less new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/public/components/page_stack/page_stack.js b/public/components/page_stack/page_stack.js new file mode 100644 index 0000000000000..baf43eca8b58c --- /dev/null +++ b/public/components/page_stack/page_stack.js @@ -0,0 +1,33 @@ +import React from 'react'; +import { PropTypes } from 'prop-types'; +import './page.less'; +import { ElementWrapper } from '../element_wrapper'; + +export const PageStack = ({ pages, selectedPageId, height, width }) => { + return ( + pages.map(page => ( +
+ { + page.elements.map(element => ( + + )) + } +
+ )) + ); +}; + +PageStack.propTypes = { + height: PropTypes.number.isRequired, + width: PropTypes.number.isRequired, + pages: PropTypes.array.isRequired, + selectedPageId: PropTypes.string.isRequired, +}; diff --git a/public/components/workpad/index.js b/public/components/workpad/index.js index 4c6ba1a4d5be8..f286be00f5d94 100644 --- a/public/components/workpad/index.js +++ b/public/components/workpad/index.js @@ -2,13 +2,15 @@ import { connect } from 'react-redux'; import { get } from 'lodash'; import { undoHistory, redoHistory } from '../../state/actions/history'; import { fetchAllRenderables } from '../../state/actions/elements'; -import { getElements, getPageById, getSelectedPage, getWorkpad } from '../../state/selectors/workpad'; +import { getElements, getPageById, getSelectedPage, getWorkpad, getPages } from '../../state/selectors/workpad'; import { getFullscreen, getEditing } from '../../state/selectors/app'; import { nextPage, previousPage } from '../../state/actions/pages'; import { Workpad as Component } from './workpad'; const mapStateToProps = (state) => { return { + pages: getPages(state), + selectedPageId: getSelectedPage(state), elements: getElements(state), style: get(getPageById(state, getSelectedPage(state)), 'style'), workpad: getWorkpad(state), diff --git a/public/components/workpad/workpad.js b/public/components/workpad/workpad.js index 5423c394727be..07be75371a7d5 100644 --- a/public/components/workpad/workpad.js +++ b/public/components/workpad/workpad.js @@ -1,12 +1,22 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Shortcuts } from 'react-shortcuts'; -import { ElementWrapper } from '../element_wrapper'; +import { PageStack } from '../page_stack'; import { Fullscreen } from '../fullscreen'; import './workpad.less'; -export const Workpad = (props) => { - const { elements, style, workpad, fetchAllRenderables, undoHistory, redoHistory, nextPage, previousPage, isFullscreen } = props; +export const Workpad = ({ + selectedPageId, + pages, + style, + workpad, + fetchAllRenderables, + undoHistory, + redoHistory, + nextPage, + previousPage, + isFullscreen, +}) => { const { height, width } = workpad; const itsTheNewStyle = Object.assign({}, style, { height, width }); @@ -46,9 +56,7 @@ export const Workpad = (props) => { /> } - { elements.map(element => ( - - ))} + ); }} @@ -58,6 +66,8 @@ export const Workpad = (props) => { }; Workpad.propTypes = { + pages: PropTypes.array.isRequired, + selectedPageId: PropTypes.string.isRequired, elements: PropTypes.array.isRequired, isFullscreen: PropTypes.bool.isRequired, workpad: PropTypes.object.isRequired, diff --git a/public/components/workpad/workpad.less b/public/components/workpad/workpad.less index d9384182457a6..f291df8096b7b 100644 --- a/public/components/workpad/workpad.less +++ b/public/components/workpad/workpad.less @@ -7,6 +7,10 @@ } } +.canvas__page { + position: absolute; +} + // For some bizarre reason, you must repeat the styles in their own blocks or they won’t be applied // https://www.sitepoint.com/html5-full-screen-api/ // #canvas--fullscreen:-moz-full-screen {