Skip to content

Commit

Permalink
Show just the button if this is a single button, or we don’t have a p…
Browse files Browse the repository at this point in the history
…rimaryLabel set
  • Loading branch information
ryelle committed Feb 22, 2018
1 parent 72a5d32 commit 7a9f27e
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ class ActionButtons extends Component {
};

getDropdown = () => {
const isSingleButton = React.Children.count( this.props.children ) === 1;
const primaryLabel = this.props.primaryLabel;

if ( ! primaryLabel || isSingleButton ) {
return this.props.children;
}

const buttons = React.Children.toArray( this.props.children );
const primary = buttons.pop();
const dropdownOptions = buttons.map( function( child, index ) {
Expand Down

0 comments on commit 7a9f27e

Please sign in to comment.