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

Nested components shouldn't receive {...props} and should accurately create overrideProps string #58

Closed
hsspain opened this issue Sep 10, 2021 · 0 comments · Fixed by #63
Assignees

Comments

@hsspain
Copy link

hsspain commented Sep 10, 2021

Example:

/* eslint-disable */
import React from "react";
import {
  EscapeHatchProps,
  Flex,
  Text,
  getOverrideProps
} from "@aws-amplify/ui-react";

export type SectionHeadingProps = {} & {
  overrides?: EscapeHatchProps | undefined | null
};
export default function SectionHeading(
  props: SectionHeadingProps
): JSX.Element {
  return (
    <Flex
      padding="0px 0px 10px 0px"
      backgroundColor="rgb(255,255,255)"
      direction="column"
      {...props}
      {...getOverrideProps(props.overrides, "Flex")}
    >
      <Flex
        padding="0px 0px 0px 0px"
        backgroundColor="rgb(255,255,255)"
        flexGrow="0"
        alignItems="flex-start"
        gap="10px"
        direction="row"
        {...props}
        {...getOverrideProps(props.overrides, "Flex")}
      >
        <Text
          fontFamily="Inter"
          color="rgb(15.539060980081558,29.73937589675188,47.8125)"
          textAlign="left"
          fontSize="48px"
          lineHeight="48px"
          value="Heading 2"
          fontWeight="300"
          {...props}
          {...getOverrideProps(props.overrides, "Text")}
        >
          Heading 2
        </Text>
      </Flex>
      <Text
        fontFamily="Inter"
        color="rgb(0,0,0)"
        textAlign="left"
        fontSize="32px"
        lineHeight="48px"
        value="subtitle"
        fontWeight="400"
        {...props}
        {...getOverrideProps(props.overrides, "Text")}
      >
        subtitle
      </Text>
    </Flex>
  );
}

Should be:

Example:

/* eslint-disable */
import React from "react";
import {
  EscapeHatchProps,
  Flex,
  Text,
  getOverrideProps
} from "@aws-amplify/ui-react";

export type SectionHeadingProps = {} & {
  overrides?: EscapeHatchProps | undefined | null
};
export default function SectionHeading(
  props: SectionHeadingProps
): JSX.Element {
  return (
    <Flex
      padding="0px 0px 10px 0px"
      backgroundColor="rgb(255,255,255)"
      direction="column"
      {...props}
      {...getOverrideProps(props.overrides, "Flex")}
    >
      <Flex
        padding="0px 0px 0px 0px"
        backgroundColor="rgb(255,255,255)"
        flexGrow="0"
        alignItems="flex-start"
        gap="10px"
        direction="row"
        {...props}
        {...getOverrideProps(props.overrides, "Flex.Flex")}
      >
        <Text
          fontFamily="Inter"
          color="rgb(15.539060980081558,29.73937589675188,47.8125)"
          textAlign="left"
          fontSize="48px"
          lineHeight="48px"
          value="Heading 2"
          fontWeight="300"
          {...getOverrideProps(props.overrides, "Flex.Flex.Text")}
        >
          Heading 2
        </Text>
      </Flex>
      <Text
        fontFamily="Inter"
        color="rgb(0,0,0)"
        textAlign="left"
        fontSize="32px"
        lineHeight="48px"
        value="subtitle"
        fontWeight="400"
        {...getOverrideProps(props.overrides, "Flex.Text")}
      >
        subtitle
      </Text>
    </Flex>
  );
}
@dpilch dpilch self-assigned this Sep 10, 2021
@frimfram frimfram linked a pull request Sep 10, 2021 that will close this issue
dpilch added a commit that referenced this issue Sep 10, 2021
Set correct path for getOverrideProps

Resolves #58
frimfram pushed a commit that referenced this issue Sep 10, 2021
Set correct path for getOverrideProps

Resolves #58
frimfram pushed a commit that referenced this issue Sep 10, 2021
Set correct path for getOverrideProps

Resolves #58
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 a pull request may close this issue.

2 participants