1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00
This commit is contained in:
Matthias Kretschmann 2020-08-03 19:25:21 +02:00
parent d72d798b06
commit 15ba3de211
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -6,6 +6,19 @@ import FilesInput from '../../molecules/FormFields/FilesInput'
import Terms from '../../molecules/FormFields/Terms' import Terms from '../../molecules/FormFields/Terms'
import Price from '../../molecules/FormFields/Price' 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 { export default function InputElement(props: InputProps): ReactElement {
const { type, options, rows, name, prefix, postfix } = props const { type, options, rows, name, prefix, postfix } = props
@ -65,23 +78,11 @@ export default function InputElement(props: InputProps): ReactElement {
return prefix || postfix ? ( return prefix || postfix ? (
<div className={`${prefix ? styles.prefixGroup : styles.postfixGroup}`}> <div className={`${prefix ? styles.prefixGroup : styles.postfixGroup}`}>
{prefix && <div className={styles.prefix}>{prefix}</div>} {prefix && <div className={styles.prefix}>{prefix}</div>}
<input <DefaultInput name={name} type={type || 'text'} />
id={name}
className={styles.input}
name={name}
{...props}
type={type || 'text'}
/>
{postfix && <div className={styles.postfix}>{postfix}</div>} {postfix && <div className={styles.postfix}>{postfix}</div>}
</div> </div>
) : ( ) : (
<input <DefaultInput name={name} type={type || 'text'} />
id={name}
className={styles.input}
name={name}
{...props}
type={type || 'text'}
/>
) )
} }
} }