diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-03-28 19:56:46 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-04-22 19:19:01 +0200 |
commit | 64d8d0464dedeabf09b5a651151f177dba2053df (patch) | |
tree | 0de37076e213287faa9e397561960f4cbf997cf3 /app/javascript/flavours/glitch/components/status_content.js | |
parent | 2888f74c1219e53e0aca28263ea8289d17264c21 (diff) |
Add show more/less toggle for entire threads in web UI
Inspired from b6003afcdb1b89eb967a2b211e3b4e26aed9ac9d but using component properties instead of redux store for hidden/revealed state.
Diffstat (limited to 'app/javascript/flavours/glitch/components/status_content.js')
-rw-r--r-- | app/javascript/flavours/glitch/components/status_content.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index 26d5b7c0f..32b0770cb 100644 --- a/app/javascript/flavours/glitch/components/status_content.js +++ b/app/javascript/flavours/glitch/components/status_content.js @@ -12,7 +12,7 @@ export default class StatusContent extends React.PureComponent { status: ImmutablePropTypes.map.isRequired, expanded: PropTypes.bool, collapsed: PropTypes.bool, - setExpansion: PropTypes.func, + onExpandedToggle: PropTypes.func, media: PropTypes.element, mediaIcon: PropTypes.string, parseClick: PropTypes.func, @@ -112,8 +112,8 @@ export default class StatusContent extends React.PureComponent { handleSpoilerClick = (e) => { e.preventDefault(); - if (this.props.setExpansion) { - this.props.setExpansion(!this.props.expanded); + if (this.props.onExpandedToggle) { + this.props.onExpandedToggle(); } else { this.setState({ hidden: !this.state.hidden }); } @@ -132,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') }; |