Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 59a2118

Browse files
UuidField migrated
1 parent ac4b047 commit 59a2118

File tree

3 files changed

+37
-21
lines changed

3 files changed

+37
-21
lines changed
Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
import { TextField } from '@material-ui/core';
2-
import React, { FormEventHandler, StatelessComponent } from 'react';
2+
import React, { ComponentType, StatelessComponent } from 'react';
33
import { ComposedComponent } from 'react-schema-form';
4+
import { FormInputProps } from './reactSchemaForms';
45

5-
interface TextAreaFieldProps {
6-
error: string;
7-
form: {
8-
description: string;
9-
htmlClass: string;
10-
placeholder: string;
11-
readonly: boolean;
12-
title: string;
13-
type: string;
14-
};
15-
onChangeValidate: FormEventHandler;
16-
value: string;
17-
}
18-
19-
const TextAreaField: StatelessComponent<TextAreaFieldProps> = ({
6+
const TextAreaField: StatelessComponent<FormInputProps> = ({
207
form,
218
error,
229
onChangeValidate,
@@ -40,4 +27,6 @@ const TextAreaField: StatelessComponent<TextAreaFieldProps> = ({
4027
</div>
4128
);
4229

43-
export default ComposedComponent.default(TextAreaField);
30+
export default ComposedComponent.default(TextAreaField) as ComponentType<
31+
FormInputProps
32+
>;

src/components/HyperMediaControls/UuidField.js renamed to src/components/HyperMediaControls/UuidField.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React from 'react';
21
import { Button, TextField } from '@material-ui/core';
3-
import { SpaceBar } from '../Icons';
4-
import uuid from 'uuid';
2+
import React from 'react';
53
import { ComposedComponent } from 'react-schema-form';
4+
import uuid from 'uuid';
5+
import { SpaceBar } from '../Icons';
6+
import { FormInputProps } from './reactSchemaForms';
67

7-
class UuidField extends React.PureComponent {
8+
class UuidField extends React.PureComponent<FormInputProps> {
89
constructor(props) {
910
super(props);
1011

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FormEventHandler } from 'react';
2+
3+
interface Form {
4+
description: string;
5+
htmlClass: string;
6+
key: string;
7+
placeholder: string;
8+
readonly: boolean;
9+
title: string;
10+
type: string;
11+
}
12+
13+
export interface FormInputProps {
14+
error: string;
15+
form: Form;
16+
onChangeValidate: FormEventHandler;
17+
model: { [key: string]: any };
18+
onChange: (key: string, value: string) => void;
19+
setDefault: (
20+
key: string,
21+
model: { [key: string]: any },
22+
form: Form,
23+
value: string,
24+
) => void;
25+
value: string;
26+
}

0 commit comments

Comments
 (0)