|
|
@ -48,57 +48,62 @@ export default class LocalSettingsPageItem extends React.PureComponent { |
|
|
|
|
|
|
|
|
|
|
|
if (options && options.length > 0) { |
|
|
|
if (options && options.length > 0) { |
|
|
|
const currentValue = settings.getIn(item); |
|
|
|
const currentValue = settings.getIn(item); |
|
|
|
const optionElems = options && options.length > 0 && options.map((opt) => ( |
|
|
|
const optionElems = options && options.length > 0 && options.map((opt) => { |
|
|
|
<option |
|
|
|
let optionId = `${id}--${opt.value}`; |
|
|
|
key={opt.value} |
|
|
|
return ( |
|
|
|
value={opt.value} |
|
|
|
<label htmlFor={optionId}> |
|
|
|
> |
|
|
|
<input type='radio' |
|
|
|
{opt.message} |
|
|
|
name={id} |
|
|
|
</option> |
|
|
|
id={optionId} |
|
|
|
)); |
|
|
|
value={opt.value} |
|
|
|
return ( |
|
|
|
|
|
|
|
<label className='glitch local-settings__page__item' htmlFor={id}> |
|
|
|
|
|
|
|
<p>{children}</p> |
|
|
|
|
|
|
|
<p> |
|
|
|
|
|
|
|
<select |
|
|
|
|
|
|
|
id={id} |
|
|
|
|
|
|
|
disabled={!enabled} |
|
|
|
|
|
|
|
onBlur={handleChange} |
|
|
|
onBlur={handleChange} |
|
|
|
onChange={handleChange} |
|
|
|
onChange={handleChange} |
|
|
|
value={currentValue} |
|
|
|
checked={ currentValue === opt.value } |
|
|
|
> |
|
|
|
disabled={!enabled} |
|
|
|
{optionElems} |
|
|
|
/> |
|
|
|
</select> |
|
|
|
{opt.message} |
|
|
|
</p> |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<div class='glitch local-settings__page__item radio_buttons'> |
|
|
|
|
|
|
|
<fieldset> |
|
|
|
|
|
|
|
<legend>{children}</legend> |
|
|
|
|
|
|
|
{optionElems} |
|
|
|
|
|
|
|
</fieldset> |
|
|
|
|
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} else if (placeholder) { |
|
|
|
} else if (placeholder) { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<label className='glitch local-settings__page__item' htmlFor={id}> |
|
|
|
<div className='glitch local-settings__page__item string'> |
|
|
|
<p>{children}</p> |
|
|
|
<label htmlFor={id}> |
|
|
|
<p> |
|
|
|
<p>{children}</p> |
|
|
|
<input |
|
|
|
<p> |
|
|
|
id={id} |
|
|
|
<input |
|
|
|
type='text' |
|
|
|
id={id} |
|
|
|
value={settings.getIn(item)} |
|
|
|
type='text' |
|
|
|
placeholder={placeholder} |
|
|
|
value={settings.getIn(item)} |
|
|
|
onChange={handleChange} |
|
|
|
placeholder={placeholder} |
|
|
|
disabled={!enabled} |
|
|
|
onChange={handleChange} |
|
|
|
/> |
|
|
|
disabled={!enabled} |
|
|
|
</p> |
|
|
|
/> |
|
|
|
</label> |
|
|
|
</p> |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} else return ( |
|
|
|
} else return ( |
|
|
|
<label className='glitch local-settings__page__item' htmlFor={id}> |
|
|
|
<div className='glitch local-settings__page__item boolean'> |
|
|
|
<input |
|
|
|
<label htmlFor={id}> |
|
|
|
id={id} |
|
|
|
<input |
|
|
|
type='checkbox' |
|
|
|
id={id} |
|
|
|
checked={settings.getIn(item)} |
|
|
|
type='checkbox' |
|
|
|
onChange={handleChange} |
|
|
|
checked={settings.getIn(item)} |
|
|
|
disabled={!enabled} |
|
|
|
onChange={handleChange} |
|
|
|
/> |
|
|
|
disabled={!enabled} |
|
|
|
{children} |
|
|
|
/> |
|
|
|
</label> |
|
|
|
{children} |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|