From ddb0a9f1ce2c5bf1831a625ae89bb68828f34c64 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Sun, 9 Aug 2020 23:32:02 -0400 Subject: [PATCH] update/fix: forum/components/SplitDropdown --- js/src/common/components/SplitDropdown.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/js/src/common/components/SplitDropdown.js b/js/src/common/components/SplitDropdown.js index 75533813a..dff3dd4d2 100644 --- a/js/src/common/components/SplitDropdown.js +++ b/js/src/common/components/SplitDropdown.js @@ -14,18 +14,18 @@ export default class SplitDropdown extends Dropdown { attrs.menuClassName += ' Dropdown-menu--right'; } - getButton() { - // Make a copy of the props of the first child component. We will assign - // these props to a new button, so that it has exactly the same behaviour as + getButton(children) { + // Make a copy of the attrs of the first child component. We will assign + // these attrs to a new button, so that it has exactly the same behaviour as // the first child. - const firstChild = this.getFirstChild(); - const buttonProps = Object.assign({}, firstChild.props); - buttonProps.className = (buttonProps.className || '') + ' SplitDropdown-button Button ' + this.props.buttonClassName; + const firstChild = this.getFirstChild(children); + const buttonAttrs = Object.assign({}, firstChild.attrs); + buttonAttrs.className = (buttonAttrs.className || '') + ' SplitDropdown-button Button ' + this.attrs.buttonClassName; return [ - Button.component(buttonProps), - , ]; @@ -38,8 +38,8 @@ export default class SplitDropdown extends Dropdown { * @return {*} * @protected */ - getFirstChild() { - let firstChild = this.props.children; + getFirstChild(children) { + let firstChild = children; while (firstChild instanceof Array) firstChild = firstChild[0];