mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Use onToggle with event open value
This commit is contained in:
parent
edbbb48015
commit
21a0cbcc5c
1 changed files with 4 additions and 5 deletions
|
@ -62,11 +62,10 @@ class Section extends PureComponent {
|
||||||
collapsed: !this.props.open,
|
collapsed: !this.props.open,
|
||||||
};
|
};
|
||||||
|
|
||||||
handleClick = () => {
|
handleClick = (e) => {
|
||||||
const { onOpen } = this.props;
|
const { onOpen } = this.props;
|
||||||
const { collapsed } = this.state;
|
|
||||||
|
this.setState({ collapsed: !e.currentTarget.open }, () => onOpen && onOpen());
|
||||||
this.setState({ collapsed: !collapsed }, () => onOpen && onOpen());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
@ -74,7 +73,7 @@ class Section extends PureComponent {
|
||||||
const { collapsed } = this.state;
|
const { collapsed } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<details open={!collapsed} onOpen={this.handleClick} className={classNames('about__section', { active: !collapsed })}>
|
<details open={!collapsed} onToggle={this.handleClick} className={classNames('about__section', { active: !collapsed })}>
|
||||||
<summary className='about__section__title'>
|
<summary className='about__section__title'>
|
||||||
<Icon id={collapsed ? 'chevron-right' : 'chevron-down'} icon={collapsed ? ChevronRightIcon : ExpandMoreIcon} /> {title}
|
<Icon id={collapsed ? 'chevron-right' : 'chevron-down'} icon={collapsed ? ChevronRightIcon : ExpandMoreIcon} /> {title}
|
||||||
</summary>
|
</summary>
|
||||||
|
|
Loading…
Reference in a new issue