-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdata.component.tsx
More file actions
46 lines (44 loc) · 1.29 KB
/
data.component.tsx
File metadata and controls
46 lines (44 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import { Formik, Form } from 'formik';
import { TextFieldComponent, CheckboxComponent } from 'common/components';
import { CommandFooterComponent } from '../../../common-app/command-footer';
import { Project } from '../project.vm';
import { formValidation } from './data.validations';
interface Props {
project: Project;
onSave: (project: Project) => void;
onCancel: () => void;
className: string;
}
export const DataComponent: React.FunctionComponent<Props> = ({
project,
onSave,
onCancel,
className,
}) => {
return (
<Formik
initialValues={project}
enableReinitialize={true}
onSubmit={onSave}
validate={formValidation.validateForm}
>
{() => (
<Form className={className}>
<TextFieldComponent
label="Id"
name="id"
InputProps={{
readOnly: true,
}}
/>
<TextFieldComponent label="Nombre" name="name" />
<TextFieldComponent label="Id Externo" name="externalId" />
<TextFieldComponent label="Comentarios" name="comments" multiline />
<CheckboxComponent label="Activo" name="isActive" color="primary" />
<CommandFooterComponent onCancel={onCancel} />
</Form>
)}
</Formik>
);
};