Merge pull request #7471 from backstage/emmaindal/styles-button-as-link-contained

Button Component styling issue
This commit is contained in:
Fredrik Adelöw
2021-10-07 14:11:16 +02:00
committed by GitHub
2 changed files with 11 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
Wrap up the `Link` component in a component to reset the color so that we can actually see the button text
@@ -40,8 +40,13 @@ export type ButtonProps = MaterialButtonProps &
*/
declare function ButtonType(props: ButtonProps): JSX.Element;
/**
* This wrapper is here to reset the color of the Link and make typescript happy.
*/
const LinkWrapper = (props: LinkProps) => <Link {...props} color="initial" />;
const ActualButton = React.forwardRef<any, ButtonProps>((props, ref) => (
<MaterialButton ref={ref} component={Link} {...props} />
<MaterialButton ref={ref} component={LinkWrapper} {...props} />
)) as { (props: ButtonProps): JSX.Element };
// TODO(Rugvip): We use this as a workaround to make the exported type be a