Skip to content

Commit

Permalink
fix: React dom failure when passing unknown props to child component (#…
Browse files Browse the repository at this point in the history
…49)

* fix: React dom failure when passing unknown props to child component

* fix: Remove colorkey
  • Loading branch information
memoyil authored Apr 9, 2021
1 parent 7a0e090 commit e3c0272
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import { ButtonMenuItemProps } from "./types";

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

const InactiveButton: PolymorphicComponent<InactiveButtonProps, "button"> = styled(Button)<InactiveButtonProps>`
background-color: transparent;
color: ${({ theme, colorKey }) => theme.colors[colorKey]};
color: ${({ theme, variant }) => (variant === variants.PRIMARY ? theme.colors.primary : theme.colors.textSubtle)};
&:hover:not(:disabled):not(:active) {
background-color: transparent;
}
Expand All @@ -24,14 +23,7 @@ const ButtonMenuItem: PolymorphicComponent<ButtonMenuItemProps, "button"> = ({
...props
}: ButtonMenuItemProps) => {
if (!isActive) {
return (
<InactiveButton
forwardedAs={as}
variant="tertiary"
colorKey={variant === variants.PRIMARY ? "primary" : "textSubtle"}
{...props}
/>
);
return <InactiveButton forwardedAs={as} variant="tertiary" {...props} />;
}

return <Button as={as} variant={variant} {...props} />;
Expand Down

0 comments on commit e3c0272

Please sign in to comment.