diff options
author | beatrix <beatrix.bitrot@gmail.com> | 2018-04-26 11:34:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-26 11:34:14 -0400 |
commit | f4ed38272be7cce814e3d3e7e5a2d1f352279e19 (patch) | |
tree | 4e26499478b18d2338be90f21428f1bd76481b89 /app/javascript/flavours/glitch/components/status_content.js | |
parent | 8f12afb5996c58ddf41ceaa20f6c4e036273d3a6 (diff) | |
parent | b383c0688a0939d25b9184e61dac72cda71f6926 (diff) |
Merge pull request #401 from ThibG/glitch-soc/features/unfold-thread
Port the “unfold thread” feature from Mastodon's UI to glitch-soc flavour
Diffstat (limited to 'app/javascript/flavours/glitch/components/status_content.js')
-rw-r--r-- | app/javascript/flavours/glitch/components/status_content.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index 3bb3c7a12..32b0770cb 100644 --- a/app/javascript/flavours/glitch/components/status_content.js +++ b/app/javascript/flavours/glitch/components/status_content.js @@ -11,7 +11,8 @@ export default class StatusContent extends React.PureComponent { static propTypes = { status: ImmutablePropTypes.map.isRequired, expanded: PropTypes.bool, - setExpansion: PropTypes.func, + collapsed: PropTypes.bool, + onExpandedToggle: PropTypes.func, media: PropTypes.element, mediaIcon: PropTypes.string, parseClick: PropTypes.func, @@ -64,7 +65,7 @@ export default class StatusContent extends React.PureComponent { } onLinkClick = (e) => { - if (this.props.expanded === false) { + if (this.props.collapsed) { if (this.props.parseClick) this.props.parseClick(e); } } @@ -111,8 +112,8 @@ export default class StatusContent extends React.PureComponent { handleSpoilerClick = (e) => { e.preventDefault(); - if (this.props.setExpansion) { - this.props.setExpansion(this.props.expanded ? null : true); + if (this.props.onExpandedToggle) { + this.props.onExpandedToggle(); } else { this.setState({ hidden: !this.state.hidden }); } @@ -131,7 +132,7 @@ export default class StatusContent extends React.PureComponent { disabled, } = this.props; - const hidden = this.props.setExpansion ? !this.props.expanded : this.state.hidden; + const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden; const content = { __html: status.get('contentHtml') }; const spoilerContent = { __html: status.get('spoilerHtml') }; |