fix: author loading before quote

- Make author div not load if quote is empty
- photoinformation taking too much of the screen
- more transitions and consistent transitions
- running prettier across all files

Co-authored-by: David Ralph <me@davidcralph.co.uk>
This commit is contained in:
alexsparkes
2022-04-11 22:57:07 +01:00
parent 4498f5b934
commit 7bb48ebc8e
84 changed files with 2630 additions and 2323 deletions

View File

@@ -8,19 +8,22 @@ export default class Switch extends PureComponent {
constructor(props) {
super(props);
this.state = {
checked: (localStorage.getItem(this.props.name) === 'true')
checked: localStorage.getItem(this.props.name) === 'true',
};
}
handleChange = () => {
const value = (this.state.checked !== true);
const value = this.state.checked !== true;
localStorage.setItem(this.props.name, value);
this.setState({
checked: value
checked: value,
});
variables.stats.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`);
variables.stats.postEvent(
'setting',
`${this.props.name} ${this.state.checked === true ? 'enabled' : 'disabled'}`,
);
if (this.props.element) {
if (!document.querySelector(this.props.element)) {
@@ -30,15 +33,22 @@ export default class Switch extends PureComponent {
}
EventBus.dispatch('refresh', this.props.category);
}
};
render() {
return (
<>
<FormControlLabel
control={<SwitchUI name={this.props.name} color='primary' checked={this.state.checked} onChange={this.handleChange} />}
control={
<SwitchUI
name={this.props.name}
color="primary"
checked={this.state.checked}
onChange={this.handleChange}
/>
}
label={this.props.text}
labelPlacement='start'
labelPlacement="start"
/>
</>
);