From: David Yip Date: Mon, 16 Oct 2017 14:23:59 +0000 (-0500) Subject: Merge remote-tracking branch 'upstream/master' into gs-master X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=dbb1fce94dbd877d795898933ca344359f9b74c1;p=mastodon.git Merge remote-tracking branch 'upstream/master' into gs-master --- dbb1fce94dbd877d795898933ca344359f9b74c1 diff --cc app/javascript/mastodon/components/icon_button.js index 6fb191c6b,d8e445cef..651b89566 --- a/app/javascript/mastodon/components/icon_button.js +++ b/app/javascript/mastodon/components/icon_button.js @@@ -50,64 -50,42 +51,63 @@@ export default class IconButton extend ...this.props.style, ...(this.props.active ? this.props.activeStyle : {}), }; + if (!this.props.label) { + style.width = `${this.props.size * 1.28571429}px`; + } else { + style.textAlign = 'left'; + } - const classes = ['icon-button']; - - if (this.props.active) { - classes.push('active'); - } - - if (this.props.disabled) { - classes.push('disabled'); - } - - if (this.props.inverted) { - classes.push('inverted'); - } - - if (this.props.overlay) { - classes.push('overlayed'); - } - - if (this.props.className) { - classes.push(this.props.className); - } + const { + active, + animate, + className, + disabled, + expanded, + icon, + inverted, + overlay, + pressed, + tabIndex, + title, + } = this.props; + + const classes = classNames(className, 'icon-button', { + active, + disabled, + inverted, + overlayed: overlay, + }); + const flipDeg = this.props.flip ? -180 : -360; + const rotateDeg = this.props.active ? flipDeg : 0; + + const motionDefaultStyle = { + rotate: rotateDeg, + }; + + const springOpts = { + stiffness: this.props.flip ? 60 : 120, + damping: 7, + }; + const motionStyle = { + rotate: this.props.animate ? spring(rotateDeg, springOpts) : 0, + }; + return ( - + {({ rotate }) =>