mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
refactor
This commit is contained in:
parent
d72d798b06
commit
15ba3de211
@ -6,6 +6,19 @@ import FilesInput from '../../molecules/FormFields/FilesInput'
|
||||
import Terms from '../../molecules/FormFields/Terms'
|
||||
import Price from '../../molecules/FormFields/Price'
|
||||
|
||||
const DefaultInput = (
|
||||
{ name, type }: { name: string; type?: string },
|
||||
props: InputProps
|
||||
) => (
|
||||
<input
|
||||
id={name}
|
||||
className={styles.input}
|
||||
name={name}
|
||||
{...props}
|
||||
type={type || 'text'}
|
||||
/>
|
||||
)
|
||||
|
||||
export default function InputElement(props: InputProps): ReactElement {
|
||||
const { type, options, rows, name, prefix, postfix } = props
|
||||
|
||||
@ -65,23 +78,11 @@ export default function InputElement(props: InputProps): ReactElement {
|
||||
return prefix || postfix ? (
|
||||
<div className={`${prefix ? styles.prefixGroup : styles.postfixGroup}`}>
|
||||
{prefix && <div className={styles.prefix}>{prefix}</div>}
|
||||
<input
|
||||
id={name}
|
||||
className={styles.input}
|
||||
name={name}
|
||||
{...props}
|
||||
type={type || 'text'}
|
||||
/>
|
||||
<DefaultInput name={name} type={type || 'text'} />
|
||||
{postfix && <div className={styles.postfix}>{postfix}</div>}
|
||||
</div>
|
||||
) : (
|
||||
<input
|
||||
id={name}
|
||||
className={styles.input}
|
||||
name={name}
|
||||
{...props}
|
||||
type={type || 'text'}
|
||||
/>
|
||||
<DefaultInput name={name} type={type || 'text'} />
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user