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: remove text value from props and render bound property #70

Merged
merged 2 commits into from
Sep 14, 2021
Merged

Conversation

dpilch
Copy link
Member

@dpilch dpilch commented Sep 13, 2021

Resolves #67

  • Remove value from Text props. The value should be set as the child.
  • Render value when it is a bound property

Remove value from Text props

Before fix:

export default function CustomText(props: CustomTextProps): JSX.Element {
  return (
    <Text
      color="#ff0000"
      width="20px"
      value="Text Value"
      {...props}
      {...getOverrideProps(props.overrides, "Text")}
    >
      Text Value
    </Text>
  );
}

After fix:

export default function CustomText(props: CustomTextProps): JSX.Element {
  return (
    <Text
      color="#ff0000"
      width="20px"
      {...props}
      {...getOverrideProps(props.overrides, "Text")}
    >
      Text Value
    </Text>
  );
}

Render value when it is a bound property

before fix:

export default function CustomText(props: CustomTextProps): JSX.Element {
  const { textValue } = props;
  return (
    <Text
      color="#ff0000"
      width="20px"
      value="Text Value"
      {...getOverrideProps(props.overrides, "Text")}
    >
    </Text>
  );
}

after fix:

export default function CustomText(props: CustomTextProps): JSX.Element {
  const { textValue } = props;
  return (
    <Text
      color="#ff0000"
      width="20px"
      value="Text Value"
      {...getOverrideProps(props.overrides, "Text")}
    >
      {textValue}
    </Text>
  );
}

@dpilch dpilch requested a review from hsspain September 13, 2021 15:22
@dpilch dpilch changed the title fix: remove text value from props fix: remove text value from props and render bound property Sep 13, 2021
@dpilch dpilch merged commit aabed87 into main Sep 14, 2021
@dpilch dpilch deleted the text-value branch September 14, 2021 17:40
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.

Text value props should always be rendered as content
2 participants