Don't require destructuring to pass props to input
This commit is contained in:
parent
91978171ed
commit
ae0335d537
|
@ -78,8 +78,10 @@ export default function WalletSettings () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function WalletFields ({ wallet: { config, fields } }) {
|
function WalletFields ({ wallet: { config, fields } }) {
|
||||||
return fields.map(({ name, label, type, help, optional, hint }, i) => {
|
return fields.map(({ name, label, type, help, optional, hint, ...props }, i) => {
|
||||||
const props = {
|
const rawProps = {
|
||||||
|
...props,
|
||||||
|
name,
|
||||||
initialValue: config?.[name],
|
initialValue: config?.[name],
|
||||||
label: (
|
label: (
|
||||||
<div className='d-flex align-items-center'>
|
<div className='d-flex align-items-center'>
|
||||||
|
@ -92,16 +94,14 @@ function WalletFields ({ wallet: { config, fields } }) {
|
||||||
{optional && <small className='text-muted ms-2'>optional</small>}
|
{optional && <small className='text-muted ms-2'>optional</small>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
name,
|
|
||||||
required: !optional,
|
required: !optional,
|
||||||
autoFocus: i === 0,
|
autoFocus: i === 0
|
||||||
hint
|
|
||||||
}
|
}
|
||||||
if (type === 'text') {
|
if (type === 'text') {
|
||||||
return <ClientInput key={i} {...props} />
|
return <ClientInput key={i} {...rawProps} />
|
||||||
}
|
}
|
||||||
if (type === 'password') {
|
if (type === 'password') {
|
||||||
return <PasswordInput key={i} {...props} newPass />
|
return <PasswordInput key={i} {...rawProps} newPass />
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue