From c7f259a017b0b6afb28276f77224357ac234b892 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki Date: Sun, 2 Nov 2025 17:06:21 +0000 Subject: [PATCH] =?UTF-8?q?FoldButton=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=8D=E3=83=B3=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mastodon/components/fold_button.jsx | 85 ++++++++++--------- .../compose/components/favourite_tags.jsx | 8 +- .../styles/imastodon/compose_common.scss | 11 ++- 3 files changed, 56 insertions(+), 48 deletions(-) diff --git a/app/javascript/mastodon/components/fold_button.jsx b/app/javascript/mastodon/components/fold_button.jsx index 081c99c3022643..5a33c74fbd4224 100644 --- a/app/javascript/mastodon/components/fold_button.jsx +++ b/app/javascript/mastodon/components/fold_button.jsx @@ -1,14 +1,36 @@ -import React from 'react'; +import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; import classNames from 'classnames'; -import spring from 'react-motion/lib/spring'; +import { Icon } from '@/mastodon/components/icon'; +import ArrowDropDownIcon from '@/material-icons/400-24px/arrow_drop_down.svg?react'; -import Motion from '../features/ui/util/optional_motion'; +export default class FoldButton extends PureComponent { -import { IconButton } from './icon_button'; + static propTypes = { + active: PropTypes.bool, + activeStyle: PropTypes.object, + animate: PropTypes.bool, + className: PropTypes.string, + disabled: PropTypes.bool, + expanded: PropTypes.bool, + inverted: PropTypes.bool, + onClick: PropTypes.func, + overlay: PropTypes.bool, + pressed: PropTypes.bool, + size: PropTypes.number, + style: PropTypes.object, + tabIndex: PropTypes.number, + title: PropTypes.string, + }; -export default class FoldButton extends IconButton { + handleClick = (e) => { + e.preventDefault(); + if (!this.props.disabled && this.props.onClick) { + this.props.onClick(e); + } + }; render () { const style = { @@ -26,7 +48,6 @@ export default class FoldButton extends IconButton { className, disabled, expanded, - icon, inverted, overlay, pressed, @@ -41,42 +62,26 @@ export default class FoldButton extends IconButton { overlayed: overlay, }); - if (!animate) { - // Perf optimization: avoid unnecessary components unless - // we actually need to animate. - return ( -