diff options
author | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
commit | 4fe1689de43f4404eb9530fcfbcbfb26d6c1c13a (patch) | |
tree | 6811b845bb7f4966b10dcefa3dea404246f161c7 /app/javascript/flavours/glitch/features/local_settings/page/item | |
parent | 65c1e53a32cabcdbb7bca57002bb0f6acdebe07e (diff) | |
parent | bed63f6dae0879ac840066b031229e0d139089cd (diff) |
Diffstat (limited to 'app/javascript/flavours/glitch/features/local_settings/page/item')
-rw-r--r-- | app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx (renamed from app/javascript/flavours/glitch/features/local_settings/page/item/index.js) | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/features/local_settings/page/item/index.js b/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx index 6b24e4143..41c0676a2 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/item/index.js +++ b/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx @@ -14,6 +14,7 @@ export default class LocalSettingsPageItem extends React.PureComponent { id: PropTypes.string.isRequired, item: PropTypes.array.isRequired, onChange: PropTypes.func.isRequired, + inputProps: PropTypes.object, options: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string.isRequired, message: PropTypes.string.isRequired, @@ -30,11 +31,11 @@ export default class LocalSettingsPageItem extends React.PureComponent { if (options && options.length > 0) onChange(item, target.value); else if (placeholder) onChange(item, target.value); else onChange(item, target.checked); - } + }; render () { const { handleChange } = this; - const { settings, item, id, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props; + const { settings, item, id, inputProps, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props; let enabled = !disabled; if (dependsOn) { @@ -54,14 +55,17 @@ export default class LocalSettingsPageItem extends React.PureComponent { let optionId = `${id}--${opt.value}`; return ( <label htmlFor={optionId}> - <input type='radio' + <input + type='radio' name={id} id={optionId} + key={optionId} value={opt.value} onBlur={handleChange} onChange={handleChange} - checked={ currentValue === opt.value } + checked={currentValue === opt.value} disabled={!enabled} + {...inputProps} /> {opt.message} {opt.hint && <span className='hint'>{opt.hint}</span>} @@ -89,6 +93,7 @@ export default class LocalSettingsPageItem extends React.PureComponent { placeholder={placeholder} onChange={handleChange} disabled={!enabled} + {...inputProps} /> </p> </label> @@ -103,6 +108,7 @@ export default class LocalSettingsPageItem extends React.PureComponent { checked={settings.getIn(item)} onChange={handleChange} disabled={!enabled} + {...inputProps} /> {children} </label> |