How to use the contentful-ui-extensions-sdk.locations.LOCATION_APP 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 / extensions / marketplace / image-focal-point / src / index.js View on Github external
init(sdk => {
  if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderDialog(sdk);
  } else if (sdk.location.is(locations.LOCATION_APP)) {
    ReactDOM.render(<AppView sdk={sdk} />, document.getElementById('root'));
  } else {
    ReactDOM.render(<App sdk={sdk} />, document.getElementById('root'));
  }
});
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 / extensions / marketplace / optimizely / src / index.js View on Github external
render() {
    const { state, props } = this;
    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} />;
github contentful / extensions / lib / shared-dam-app / src / index.tsx View on Github external
if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
      render(
        <Field
          sdk={sdk as FieldExtensionSDK}
          cta={integration.cta}
          logo={integration.logo}
          makeThumbnail={integration.makeThumbnail}
          openDialog={integration.openDialog}
          isDisabled={integration.isDisabled}
        />,
        root
      );
    }

    if (sdk.location.is(locations.LOCATION_APP)) {
      render(
        <AppConfig
          name={integration.name}
          sdk={sdk as AppExtensionSDK}
          parameterDefinitions={integration.parameterDefinitions}
          validateParameters={integration.validateParameters}
          logo={integration.logo}
          color={integration.color}
          description={integration.description}
        />,
        root
      );
    }
  });
}