improve Window controls Settings

main
Mike Fix 5 years ago
parent 1bea3feeff
commit 10fa1ce2ab
No known key found for this signature in database
GPG Key ID: 1D85E862314CA79F

@ -36,7 +36,11 @@ function WindowSettings({
}) { }) {
return ( return (
<div className="settings-content"> <div className="settings-content">
<ThemeSelect selected={windowTheme || 'none'} onChange={onChange.bind(null, 'windowTheme')} /> <ThemeSelect
selected={windowTheme || 'none'}
windowControls={windowControls}
onChange={onChange}
/>
<div className="row"> <div className="row">
<Slider <Slider
label="Padding (vert)" label="Padding (vert)"
@ -71,11 +75,6 @@ function WindowSettings({
/> />
</div> </div>
)} )}
<Toggle
label="Window controls"
enabled={windowControls}
onChange={onChange.bind(null, 'windowControls')}
/>
<Toggle <Toggle
label="Auto-adjust width" label="Auto-adjust width"
enabled={widthAdjustment} enabled={widthAdjustment}

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import Toggle from './Toggle'
import { None, BW, Sharp, Boxy } from './svg/WindowThemes' import { None, BW, Sharp, Boxy } from './svg/WindowThemes'
import { COLORS } from '../lib/constants' import { COLORS } from '../lib/constants'
@ -7,7 +8,7 @@ const WINDOW_THEMES_MAP = { none: None, sharp: Sharp, bw: BW, boxy: Boxy }
class ThemeSelect extends React.Component { class ThemeSelect extends React.Component {
select = theme => { select = theme => {
if (this.props.selected !== theme) { if (this.props.selected !== theme) {
this.props.onChange(theme) this.props.onChange('windowTheme', theme)
} }
} }
@ -54,25 +55,27 @@ class ThemeSelect extends React.Component {
render() { render() {
return ( return (
<>
<div className="window-theme"> <div className="window-theme">
<span className="label" id="window-theme-label"> <Toggle
Theme label="Window controls"
</span> enabled={this.props.windowControls}
onChange={v => this.props.onChange('windowControls', v)}
/>
{this.props.windowControls && (
<div className="themes" role="radiogroup" aria-labelledby="window-theme-label"> <div className="themes" role="radiogroup" aria-labelledby="window-theme-label">
{this.renderThemes()} {this.renderThemes()}
</div> </div>
)}
<style jsx> <style jsx>
{` {`
.window-theme {
padding: 8px;
}
.window-theme span { .window-theme span {
display: inline-block; display: inline-block;
margin-bottom: 2px; margin-bottom: 2px;
} }
.themes { .themes {
padding: 4px 8px 8px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;
@ -82,6 +85,7 @@ class ThemeSelect extends React.Component {
`} `}
</style> </style>
</div> </div>
</>
) )
} }
} }

Loading…
Cancel
Save