Skip to content

Commit

Permalink
fix(split-button): prevent padding props being spread into main button
Browse files Browse the repository at this point in the history
  • Loading branch information
edleeks87 committed Apr 13, 2021
1 parent 5495b2d commit 7bd7ade
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/components/split-button/split-button.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Button, { ButtonWithForwardRef } from "../button";
import StyledSplitButton from "./split-button.style";
import StyledSplitButtonToggle from "./split-button-toggle.style";
import StyledSplitButtonChildrenContainer from "./split-button-children.style";
import { validProps } from "../../utils/ether/ether";
import Events from "../../utils/helpers/events";
import guid from "../../utils/helpers/guid";
import Popover from "../../__internal__/popover";
Expand Down Expand Up @@ -105,13 +104,29 @@ class SplitButton extends Component {
};

get mainButtonProps() {
const { ...props } = validProps(this);
props.onMouseEnter = this.hideButtons;
props.onFocus = this.hideButtons;
props.onTouchStart = this.hideButtons;
props.iconPosition = this.props.iconPosition;
const {
as,
buttonType,
disabled,
iconType,
onClick,
size,
subtext,
} = this.props;

return props;
return {
onMouseEnter: this.hideButtons,
onFocus: this.hideButtons,
onTouchStart: this.hideButtons,
iconPosition: this.props.iconPosition,
as,
buttonType,
disabled,
iconType,
onClick,
size,
subtext,
};
}

get toggleButtonProps() {
Expand Down

0 comments on commit 7bd7ade

Please sign in to comment.