Sha256: 2ae744bb45cc8b542067ea4fe443501bbc3b8677083e8841a924087d0e0e8e37

Contents?: true

Size: 874 Bytes

Versions: 2

Compression:

Stored size: 874 Bytes

Contents

import React from 'react';

import createContainer from './create_container.jsx';
import createResolverRoot from './create_resolver_root.jsx';
import resolve from './resolve';

export default function(Component, options = {}) {
  const ContainerComponent = createContainer(Component, {
    fragments: {
      page: resolve('page', {
        property: 'pageId'
      }),
      ...(options.fragments || {})
    },
  });

  class Page extends React.Component {
    static childContextTypes = {
      pageHooks: React.PropTypes.object,
      pageIsPreloaded: React.PropTypes.bool
    }

    getChildContext() {
      return {
        pageHooks: this.props.pageHooks,
        pageIsPreloaded: this.props.isPreloaded
      };
    }

    render() {
      return (
        <ContainerComponent pageId={this.props.pageId} />
      );
    }
  };

  return createResolverRoot(Page);
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-react-0.1.1 js/src/create_page.jsx
pageflow-react-0.1.0 js/src/create_page.jsx