Skip to content

Commit 044d023

Browse files
committed
clean files
1 parent ca74047 commit 044d023

6 files changed

Lines changed: 49 additions & 74 deletions

File tree

application/public/favicon.ico

-3.78 KB
Binary file not shown.

application/public/logo192.png

-5.22 KB
Binary file not shown.

application/public/logo512.png

-9.44 KB
Binary file not shown.

application/public/manifest.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

application/public/robots.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

application/src/App.tsx

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,60 @@ interface onChangeType {
66
value: string;
77
}
88

9+
const inputs = {
10+
checkbox: {
11+
type: "checkbox",
12+
options: {
13+
a: { text: "checkbox a" },
14+
b: { text: "checkbox b" },
15+
c: { text: "checkbox c" }
16+
}
17+
},
18+
radio: {
19+
type: "radio",
20+
options: {
21+
a: { text: "radio a" },
22+
b: { text: "radio b" },
23+
c: { text: "radio c" }
24+
}
25+
},
26+
27+
dropdown: {
28+
type: "dropdown",
29+
placeholder: "dropdown placehoder",
30+
options: {
31+
a: { text: "dropdown a" },
32+
b: { text: "dropdown b" },
33+
c: { text: "dropdown c" }
34+
}
35+
},
36+
select: {
37+
type: "select",
38+
placeholder: "select placehoder",
39+
options: {
40+
a: { text: "select a" },
41+
b: { text: "select b" },
42+
c: { text: "select c" }
43+
}
44+
},
45+
46+
number: { type: "number" },
47+
plop: { type: "password" },
48+
text: { type: "text" },
49+
textarea: { type: "textarea", placeholder: "toto" }
50+
};
51+
952
const App: React.FC = () => {
10-
const [state, setState] = useState({});
53+
const [values, setValues] = useState({});
1154
const onChange = (
1255
e: React.ChangeEvent<any>,
1356
{ key, value }: onChangeType
1457
) => {
15-
setState({ ...state, [key]: value });
58+
setValues({ ...values, [key]: value });
1659
};
1760
useEffect(() => {
18-
console.log("STATE", state);
19-
}, [state]);
61+
console.log("VALUES", values);
62+
}, [values]);
2063

2164
const [errors, setErrors] = useState({});
2265
const onError = ({ key, value }: onChangeType) => {
@@ -29,54 +72,13 @@ const App: React.FC = () => {
2972
return (
3073
<FormBuilder
3174
{...{
32-
inputs: {
33-
checkbox: {
34-
type: "checkbox",
35-
options: {
36-
a: { text: "checkbox a" },
37-
b: { text: "checkbox b" },
38-
c: { text: "checkbox c" }
39-
}
40-
},
41-
radio: {
42-
type: "radio",
43-
options: {
44-
a: { text: "radio a" },
45-
b: { text: "radio b" },
46-
c: { text: "radio c" }
47-
}
48-
},
49-
50-
dropdown: {
51-
type: "dropdown",
52-
placeholder: "dropdown placehoder",
53-
options: {
54-
a: { text: "dropdown a" },
55-
b: { text: "dropdown b" },
56-
c: { text: "dropdown c" }
57-
}
58-
},
59-
select: {
60-
type: "select",
61-
placeholder: "select placehoder",
62-
options: {
63-
a: { text: "select a" },
64-
b: { text: "select b" },
65-
c: { text: "select c" }
66-
}
67-
},
68-
69-
number: { type: "number" },
70-
plop: { type: "password" },
71-
text: { type: "text" },
72-
textarea: { type: "textarea", placeholder: "toto" }
73-
},
75+
inputs,
7476

7577
onError,
7678
onChange,
7779

7880
errors,
79-
values: state
81+
values
8082
}}
8183
/>
8284
);

0 commit comments

Comments
 (0)