Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(studio-ui-codegen-react): include all imports used in generated components #40

Merged
merged 1 commit into from
Sep 7, 2021

Conversation

dpilch
Copy link
Contributor

@dpilch dpilch commented Aug 31, 2021

Resolved #37

Include all necessary imports in generated React components. Also sort named
imports.

Using this Studio component will produce the following React component.

{
  appId: 'd37nrm8rzt3oek',
  bindingProperties: {},
  componentType: 'Box',
  environmentName: 'staging',
  componentId: 's-s4mU579Ycf6JGHwhqT',
  name: 'aawwdd',
  overrides: {},
  properties: {},
  variants: [],
}
/* eslint-disable */
import React from "react";
import { EscapeHatchProps, View, getOverrideProps } from "@aws-amplify/ui-react";

export type aawwddProps = {} & {
    overrides?: EscapeHatchProps | undefined | null;
};
export default function aawwdd(props: aawwddProps): JSX.Element {
    return (<View {...props} {...getOverrideProps(props.overrides, "View")}></View>);
}

JSX is included in global scope for Typescript.

@dpilch dpilch requested review from frimfram and johnpc August 31, 2021 20:46
@dpilch dpilch marked this pull request as ready for review August 31, 2021 20:48
Copy link
Contributor

@frimfram frimfram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

@johnpc johnpc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works!

@dpilch dpilch merged commit 04f86bb into main Sep 7, 2021
@dpilch dpilch deleted the include-imports branch September 7, 2021 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated studio components are broken by default
3 participants