common: fix Button children issue introduced in admin PR

This commit is contained in:
David Sevilla Martin 2020-05-03 10:42:25 -04:00
parent 8b4046fdd4
commit 717e8aa27e
No known key found for this signature in database
GPG Key ID: F764F1417E16B15F

View File

@ -48,9 +48,8 @@ export interface ButtonProps extends ComponentProps {
*/
export default class Button<T extends ButtonProps = ButtonProps> extends Component<T> {
view() {
const attrs: T = { ...this.props };
const children = extract(attrs, 'children');
const attrs = (({ children, ...o }) => o)(this.props) as T;
const children = this.props.children;
attrs.className = attrs.className || '';
attrs.type = attrs.type || 'button';
@ -63,7 +62,7 @@ export default class Button<T extends ButtonProps = ButtonProps> extends Compone
// If nothing else is provided, we use the textual button content as tooltip
if (!attrs.title && children) {
attrs.title = extractText(this.props.children);
attrs.title = extractText(children);
}
const iconName = extract(attrs, 'icon');