Totally functional! Just need to refactor like crazy.

This commit is contained in:
MrOnosa
2020-10-21 19:26:47 -05:00
parent 392f14c89d
commit b45129f3d0
2 changed files with 18 additions and 5 deletions

View File

@@ -6,8 +6,8 @@ export default class Section extends React.PureComponent {
constructor(...args) {
super(...args);
this.state = {
display: 'block',
transform: 'rotate(-180deg)'
display: 'none',
transform: 'rotate(0)'
};
}
@@ -19,6 +19,10 @@ export default class Section extends React.PureComponent {
display: display,
transform: transform
});
if(this.props.onToggle) {
this.props.onToggle(display);
}
}
render() {

View File

@@ -14,7 +14,8 @@ export default class BackgroundSettings extends React.PureComponent {
this.state = {
blur: 0,
brightness: 100,
gradientSettings: this.DefaultGradientSettings
gradientSettings: this.DefaultGradientSettings,
shown: false
};
}
@@ -262,6 +263,14 @@ export default class BackgroundSettings extends React.PureComponent {
});
};
onSection = () => {
this.setState((state) => {
return {
shown: !state.shown
};
})
}
render() {
let colourSettings = null;
if (typeof this.state.gradientSettings === 'object') {
@@ -294,7 +303,7 @@ export default class BackgroundSettings extends React.PureComponent {
}
return (
<React.Fragment>
<Section title={this.props.language.background.title} name='background'>
<Section title={this.props.language.background.title} name='background' onToggle={this.onSection}>
<ul>
<Checkbox name='view' text={this.props.language.background.view} />
<Checkbox name='favouriteEnabled' text={this.props.language.background.favourite} />
@@ -329,7 +338,7 @@ export default class BackgroundSettings extends React.PureComponent {
<ul>
<p>{this.props.language.background.customcolour} <span className='modalLink' onClick={() => this.resetItem('customBackgroundColour')}>{this.props.language.reset}</span></p>
<input id='customBackgroundHex' type='hidden' value={this.currentGradientSettings()} />
{colourSettings}
{this.state.shown && colourSettings}
</ul>
</Section>
</React.Fragment>