Refactor the infamous three-valued boolean into two booleans, trying to simplify the logic

This commit is contained in:
Thibaut Girka
2018-03-28 15:40:34 +02:00
parent 259bc9840b
commit 2888f74c12
5 changed files with 49 additions and 41 deletions

View File

@@ -76,7 +76,7 @@ export default class Status extends ImmutablePureComponent {
state = {
fullscreen: false,
isExpanded: null,
isExpanded: false,
};
componentWillMount () {
@@ -96,7 +96,7 @@ export default class Status extends ImmutablePureComponent {
handleExpandedToggle = () => {
if (this.props.status.get('spoiler_text')) {
this.setExpansion(this.state.isExpanded ? null : true);
this.setExpansion(!this.state.isExpanded);
}
};
@@ -292,7 +292,7 @@ export default class Status extends ImmutablePureComponent {
}
setExpansion = value => {
this.setState({ isExpanded: value ? true : null });
this.setState({ isExpanded: value });
}
setRef = c => {