How to use the contentful-ui-extensions-sdk.locations.LOCATION_ENTRY_SIDEBAR function in contentful-ui-extensions-sdk

To help you get started, we’ve selected a few contentful-ui-extensions-sdk examples, based on popular ways it is used in public projects.

github contentful / ui-extensions-sdk / test / extensions / test-extension / src / index.js View on Github external
init(sdk => {
  window.sdk = sdk
  if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
    renderExtension(<FieldExtension sdk={sdk} />)
  } else if (sdk.location.is(locations.LOCATION_PAGE)) {
    renderExtension(<PageExtension sdk={sdk} />)
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    renderExtension(<SidebarExtension sdk={sdk} />)
  } else if (sdk.location.is(locations.LOCATION_ENTRY_EDITOR)) {
    renderExtension(<EntryEditorExtension sdk={sdk} />)
  } else if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderExtension(<DialogExtension sdk={sdk} />)
  }
})
github contentful / extensions / marketplace / gatsby-preview / src / index.js View on Github external
init(sdk => {
  const root = document.getElementById('root');

  if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    render(<Sidebar sdk={sdk} />, root);
  } else if (sdk.location.is(locations.LOCATION_APP)) {
    render(<AppConfig sdk={sdk} />, root);
  }
});
github contentful / create-contentful-extension / packages / contentful-extension-scripts / template / typescript-page / src / index.tsx View on Github external
init(sdk => {
  if (sdk.location.is(locations.LOCATION_PAGE)) {
    render(<PageExtension sdk={sdk as PageExtensionSDK} />, document.getElementById('root'));
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    render(<SidebarExtension sdk={sdk as SidebarExtensionSDK} />, document.getElementById('root'));
  } else {
    return null;
  }
});
github contentful / create-contentful-extension / packages / contentful-extension-scripts / template / javascript-page / src / index.js View on Github external
init(sdk => {
  if (sdk.location.is(locations.LOCATION_PAGE)) {
    render(<PageExtension sdk={sdk} />, document.getElementById('root'));
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    render(<SidebarExtension sdk={sdk} />, document.getElementById('root'));
  } else {
    return null;
  }
});
github contentful / extensions / marketplace / readable / src / index.js View on Github external
init(extension => {
  extension.window.startAutoResizer();

  const rootElm = document.getElementById('root');

  if (extension.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    ReactDOM.render(<Sidebar extension={extension} />, rootElm);
  } else if (extension.location.is(locations.LOCATION_DIALOG)) {
    const { dialog } = extension.parameters.invocation;
    if (dialog === 'details') {
      ReactDOM.render(<DetailsDialog extension={extension} />, rootElm);
    }
  }
});
github contentful / extensions / marketplace / optimizely / src / index.js View on Github external
const { sdk } = props;
    const { client } = state;
    const { location, parameters } = sdk;

    if (location.is(locations.LOCATION_APP)) {
      return (
        <AppPage
          openAuth={this.openAuth}
          accessToken={this.state.accessToken}
          sdk={this.props.sdk}
          client={this.state.client}
        />
      );
    }

    if (location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
      if (!parameters.installation.optimizelyProjectId) {
        return <MissingProjectId />;
      }

      return <Sidebar sdk={sdk} />;
    }

    if (location.is(locations.LOCATION_ENTRY_EDITOR)) {
      const [valid, missingFields] = isValidContentType(sdk.contentType);

      if (!valid) {
        return <IncorrectContentType sdk={sdk} missingFields={missingFields} />;
      }

      return (
        <EditorPage