mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-28 04:36:45 +00:00
30 lines
715 B
TypeScript
30 lines
715 B
TypeScript
import { FC } from 'react';
|
|
import { v4 as uuid } from 'uuid';
|
|
import { InputType } from 'reactstrap/lib/Input';
|
|
|
|
interface FormGroupContainer {
|
|
value: string;
|
|
onChange: (newValue: string) => void;
|
|
id?: string;
|
|
type?: InputType;
|
|
required?: boolean;
|
|
}
|
|
|
|
export const FormGroupContainer: FC<FormGroupContainer> = (
|
|
{ children, value, onChange, id = uuid(), type = 'text', required = true },
|
|
) => (
|
|
<div className="form-group">
|
|
<label htmlFor={id} className="create-server__label">
|
|
{children}:
|
|
</label>
|
|
<input
|
|
className="form-control"
|
|
type={type}
|
|
id={id}
|
|
value={value}
|
|
required={required}
|
|
onChange={(e) => onChange(e.target.value)}
|
|
/>
|
|
</div>
|
|
);
|