first commt
This commit is contained in:
30
resources/js/components/Field.tsx
Normal file
30
resources/js/components/Field.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import React, {
|
||||
FC, HTMLInputTypeAttribute,
|
||||
ReactElement
|
||||
} from "react"
|
||||
|
||||
const Field: FC<FieldProps> = ({children, type = 'text', ...props}) => {
|
||||
|
||||
return <div className="form-group">
|
||||
{children && <label className="block text-gray-900 dark:text-gray-200"
|
||||
htmlFor={props.id ?? undefined}>
|
||||
{children}
|
||||
</label>}
|
||||
<input className="w-full mt-2 rounded dark:bg-gray-700"
|
||||
type={type}
|
||||
{...props}/>
|
||||
</div>
|
||||
}
|
||||
|
||||
export default Field
|
||||
|
||||
interface FieldProps {
|
||||
children?: ReactElement|string,
|
||||
type?: HTMLInputTypeAttribute,
|
||||
name: string,
|
||||
id?: string,
|
||||
value: any,
|
||||
placeholder?: string,
|
||||
autoFocus?: boolean,
|
||||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void,
|
||||
}
|
||||
Reference in New Issue
Block a user