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: React dom failure when passing unknown props to child component #49

Merged
merged 3 commits into from
Apr 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { ButtonMenuItemProps } from "./types";

interface InactiveButtonProps extends BaseButtonProps {
forwardedAs: BaseButtonProps["as"];
colorKey: "primary" | "textSubtle";
colorkey: "primary" | "textSubtle";
}

const InactiveButton: PolymorphicComponent<InactiveButtonProps, "button"> = styled(Button)<InactiveButtonProps>`
background-color: transparent;
color: ${({ theme, colorKey }) => theme.colors[colorKey]};
Copy link
Contributor

Choose a reason for hiding this comment

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

The initial solution here is wrong imo. If you want to clean this, a better solution is to remove the colorkey attribute and compute the color based on the variant attribute

Copy link
Contributor

Choose a reason for hiding this comment

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

@memoyil

@RabbitDoge is right in it is not an ideal solution. Do you mind fixing it? No worries if you can't, I will get to it.

Copy link
Contributor Author

@memoyil memoyil Apr 8, 2021

Choose a reason for hiding this comment

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

@hachiojidev I will try to fix it :) if I could not I will ask your help. Thanks 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hachiojidev can you review it again?

color: ${({ theme, colorkey }) => theme.colors[colorkey]};
&:hover:not(:disabled):not(:active) {
background-color: transparent;
}
Expand All @@ -28,7 +28,7 @@ const ButtonMenuItem: PolymorphicComponent<ButtonMenuItemProps, "button"> = ({
<InactiveButton
forwardedAs={as}
variant="tertiary"
colorKey={variant === variants.PRIMARY ? "primary" : "textSubtle"}
colorkey={variant === variants.PRIMARY ? "primary" : "textSubtle"}
{...props}
/>
);
Expand Down