mirror of
https://ghproxy.net/https://github.com/abhijitb/helix.git
synced 2025-08-28 11:42:38 +08:00
folder restructuring for pages
This commit is contained in:
parent
c1e7525a3a
commit
4f35d58a47
19 changed files with 26 additions and 27 deletions
57
src/components/TextInput.jsx
Normal file
57
src/components/TextInput.jsx
Normal file
|
@ -0,0 +1,57 @@
|
|||
import React from 'react';
|
||||
import FormField from './FormField';
|
||||
|
||||
/**
|
||||
* Text input component
|
||||
* @param root0
|
||||
* @param root0.label
|
||||
* @param root0.description
|
||||
* @param root0.value
|
||||
* @param root0.onChange
|
||||
* @param root0.placeholder
|
||||
* @param root0.type
|
||||
* @param root0.required
|
||||
* @param root0.disabled
|
||||
* @param root0.error
|
||||
* @param root0.className
|
||||
*/
|
||||
const TextInput = ( {
|
||||
label,
|
||||
description,
|
||||
value,
|
||||
onChange,
|
||||
placeholder = '',
|
||||
type = 'text',
|
||||
required = false,
|
||||
disabled = false,
|
||||
error = null,
|
||||
className = '',
|
||||
...props
|
||||
} ) => {
|
||||
const handleChange = ( event ) => {
|
||||
onChange( event.target.value );
|
||||
};
|
||||
|
||||
return (
|
||||
<FormField
|
||||
label={ label }
|
||||
description={ description }
|
||||
error={ error }
|
||||
required={ required }
|
||||
className={ className }
|
||||
>
|
||||
<input
|
||||
type={ type }
|
||||
value={ value || '' }
|
||||
onChange={ handleChange }
|
||||
placeholder={ placeholder }
|
||||
required={ required }
|
||||
disabled={ disabled }
|
||||
className="helix-text-input"
|
||||
{ ...props }
|
||||
/>
|
||||
</FormField>
|
||||
);
|
||||
};
|
||||
|
||||
export default TextInput;
|
Loading…
Add table
Add a link
Reference in a new issue