umwd-components 0.1.84 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ function ContactForm(_ref) {
18
18
  data
19
19
  } = _ref;
20
20
  const {
21
- maxWidth = "lg"
21
+ maxWidth
22
22
  } = data;
23
23
  const [formValues, setFormValues] = React.useState({
24
24
  name: "",
@@ -27,36 +27,43 @@ function ContactForm(_ref) {
27
27
  message: ""
28
28
  });
29
29
  const [formErrors, setFormErrors] = React.useState({});
30
+
31
+ // Setting button text on form submission
32
+ React.useState("Send");
33
+
34
+ // Setting success or failure messages states
35
+ const [showSuccessMessage, setShowSuccessMessage] = React.useState(false);
36
+ const [showFailureMessage, setShowFailureMessage] = React.useState(false);
37
+ const handleChange = e => {
38
+ const {
39
+ name,
40
+ value
41
+ } = e.target;
42
+ setFormValues({
43
+ ...formValues,
44
+ [name]: value
45
+ });
46
+ };
30
47
  const handleBlur = e => {
31
48
  const {
32
- id
49
+ name
33
50
  } = e.target;
34
51
  const errors = validate(formValues);
35
- if (errors[id]) {
52
+ if (errors[name]) {
36
53
  setFormErrors(prevErrors => ({
37
54
  ...prevErrors,
38
- [id]: errors[id]
55
+ [name]: errors[name]
39
56
  }));
40
57
  } else {
41
58
  setFormErrors(prevErrors => {
42
59
  const updatedErrors = {
43
60
  ...prevErrors
44
61
  };
45
- delete updatedErrors[id];
62
+ delete updatedErrors[name];
46
63
  return updatedErrors;
47
64
  });
48
65
  }
49
66
  };
50
- const handleChange = e => {
51
- const {
52
- id,
53
- value
54
- } = e.target;
55
- setFormValues({
56
- ...formValues,
57
- [id]: value
58
- });
59
- };
60
67
  const handleClear = () => {
61
68
  setFormValues({
62
69
  name: "",
@@ -65,8 +72,39 @@ function ContactForm(_ref) {
65
72
  message: ""
66
73
  });
67
74
  };
68
- const handleSendCallback = () => {
69
- console.log("Send callback");
75
+
76
+ /* const handleSendCallback = () => {
77
+ console.log("Send callback");
78
+ }; */
79
+
80
+ const handleSubmit = async e => {
81
+ e.preventDefault();
82
+ let isValidForm = validate(formValues);
83
+ console.log("isValidForm", isValidForm);
84
+ if (Object.keys(isValidForm).length === 0) {
85
+ const res = await fetch("/api/sendgrid", {
86
+ body: JSON.stringify({
87
+ email: formValues.email,
88
+ fullname: formValues.name,
89
+ subject: formValues.subject,
90
+ message: formValues.message
91
+ }),
92
+ headers: {
93
+ "Content-Type": "application/json"
94
+ },
95
+ method: "POST"
96
+ });
97
+ const {
98
+ error
99
+ } = await res.json();
100
+ if (error) {
101
+ setShowFailureMessage(true);
102
+ console.log(error);
103
+ return;
104
+ } else {
105
+ setShowSuccessMessage(true);
106
+ }
107
+ }
70
108
  };
71
109
  const validate = values => {
72
110
  console.log("values from validate", values);
@@ -89,24 +127,46 @@ function ContactForm(_ref) {
89
127
  return errors;
90
128
  };
91
129
  return /*#__PURE__*/React.createElement(material.Container, {
92
- maxWidth: maxWidth || "lg",
130
+ maxWidth: maxWidth ? maxWidth : "lg",
93
131
  sx: {
94
132
  my: 1
95
133
  }
96
- }, /*#__PURE__*/React.createElement(material.Paper, {
134
+ }, /*#__PURE__*/React.createElement(material.Stack, {
135
+ spacing: 2,
97
136
  sx: {
98
- p: 2
137
+ width: "100%"
99
138
  }
100
- }, /*#__PURE__*/React.createElement(material.Stack, {
101
- spacing: 2
102
139
  }, /*#__PURE__*/React.createElement(material.Typography, {
103
140
  variant: "h6",
104
141
  align: "center"
105
142
  }, "Write us"), /*#__PURE__*/React.createElement(material.Typography, {
106
143
  variant: "body1",
107
144
  align: "center"
108
- }, "We're open for any suggestion or just to have a chat"), /*#__PURE__*/React.createElement(material.TextField, {
145
+ }, "We're open for any suggestion or just to have a chat"), showSuccessMessage && /*#__PURE__*/React.createElement(material.Paper, {
146
+ sx: {
147
+ p: 2
148
+ }
149
+ }, /*#__PURE__*/React.createElement(material.Stack, {
150
+ spacing: 2
151
+ }, /*#__PURE__*/React.createElement(material.Typography, {
152
+ variant: "h6"
153
+ }, "Thank you!"), /*#__PURE__*/React.createElement(material.Typography, null, "Your e-mail has been successfully sent!"))), showFailureMessage && /*#__PURE__*/React.createElement(material.Paper, {
154
+ sx: {
155
+ p: 2
156
+ }
157
+ }, /*#__PURE__*/React.createElement(material.Stack, {
158
+ spacing: 2
159
+ }, /*#__PURE__*/React.createElement(material.Typography, null, "I am sorry, something went wrong, you could email me directly on info@jellepaulus.nl"), /*#__PURE__*/React.createElement(material.Button, {
160
+ variant: "contained"
161
+ }, "try again")))), !showSuccessMessage && !showFailureMessage && /*#__PURE__*/React.createElement(material.Paper, {
162
+ sx: {
163
+ p: 2
164
+ }
165
+ }, /*#__PURE__*/React.createElement(material.Stack, {
166
+ spacing: 2
167
+ }, /*#__PURE__*/React.createElement(material.TextField, {
109
168
  id: "name",
169
+ name: "name",
110
170
  label: "Name",
111
171
  value: formValues.name,
112
172
  variant: "outlined",
@@ -116,6 +176,7 @@ function ContactForm(_ref) {
116
176
  helperText: formErrors.name
117
177
  }), /*#__PURE__*/React.createElement(material.TextField, {
118
178
  id: "email",
179
+ name: "email",
119
180
  label: "Email",
120
181
  value: formValues.email,
121
182
  variant: "outlined",
@@ -125,6 +186,7 @@ function ContactForm(_ref) {
125
186
  helperText: formErrors.email
126
187
  }), /*#__PURE__*/React.createElement(material.TextField, {
127
188
  id: "subject",
189
+ name: "subject",
128
190
  label: "Subject",
129
191
  value: formValues.subject,
130
192
  variant: "outlined",
@@ -134,6 +196,7 @@ function ContactForm(_ref) {
134
196
  helperText: formErrors.subject
135
197
  }), /*#__PURE__*/React.createElement(material.TextField, {
136
198
  id: "message",
199
+ name: "message",
137
200
  label: "Message",
138
201
  value: formValues.message,
139
202
  variant: "outlined",
@@ -153,8 +216,7 @@ function ContactForm(_ref) {
153
216
  onClick: handleClear
154
217
  }, "Clear"), /*#__PURE__*/React.createElement(material.Button, {
155
218
  variant: "contained",
156
- color: "primary",
157
- onClick: handleSendCallback
219
+ onClick: handleSubmit
158
220
  }, "Send")))));
159
221
  }
160
222
 
@@ -32,9 +32,9 @@ function IconSection(_ref) {
32
32
  xs: 12,
33
33
  sm: 6,
34
34
  md: 4,
35
- lg: 3
35
+ lg: 3,
36
+ key: icon.id
36
37
  }, /*#__PURE__*/React.createElement(material.Card, {
37
- key: icon.id,
38
38
  sx: {
39
39
  display: "flex",
40
40
  flexDirection: "column",
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import { Container, Paper, Stack, Typography, TextField, Button } from '@mui/material';
9
+ import { Container, Stack, Typography, Paper, Button, TextField } from '@mui/material';
10
10
  import isEmail from 'validator/lib/isEmail';
11
11
 
12
12
  function ContactForm(_ref) {
@@ -14,7 +14,7 @@ function ContactForm(_ref) {
14
14
  data
15
15
  } = _ref;
16
16
  const {
17
- maxWidth = "lg"
17
+ maxWidth
18
18
  } = data;
19
19
  const [formValues, setFormValues] = React.useState({
20
20
  name: "",
@@ -23,36 +23,43 @@ function ContactForm(_ref) {
23
23
  message: ""
24
24
  });
25
25
  const [formErrors, setFormErrors] = React.useState({});
26
+
27
+ // Setting button text on form submission
28
+ React.useState("Send");
29
+
30
+ // Setting success or failure messages states
31
+ const [showSuccessMessage, setShowSuccessMessage] = React.useState(false);
32
+ const [showFailureMessage, setShowFailureMessage] = React.useState(false);
33
+ const handleChange = e => {
34
+ const {
35
+ name,
36
+ value
37
+ } = e.target;
38
+ setFormValues({
39
+ ...formValues,
40
+ [name]: value
41
+ });
42
+ };
26
43
  const handleBlur = e => {
27
44
  const {
28
- id
45
+ name
29
46
  } = e.target;
30
47
  const errors = validate(formValues);
31
- if (errors[id]) {
48
+ if (errors[name]) {
32
49
  setFormErrors(prevErrors => ({
33
50
  ...prevErrors,
34
- [id]: errors[id]
51
+ [name]: errors[name]
35
52
  }));
36
53
  } else {
37
54
  setFormErrors(prevErrors => {
38
55
  const updatedErrors = {
39
56
  ...prevErrors
40
57
  };
41
- delete updatedErrors[id];
58
+ delete updatedErrors[name];
42
59
  return updatedErrors;
43
60
  });
44
61
  }
45
62
  };
46
- const handleChange = e => {
47
- const {
48
- id,
49
- value
50
- } = e.target;
51
- setFormValues({
52
- ...formValues,
53
- [id]: value
54
- });
55
- };
56
63
  const handleClear = () => {
57
64
  setFormValues({
58
65
  name: "",
@@ -61,8 +68,39 @@ function ContactForm(_ref) {
61
68
  message: ""
62
69
  });
63
70
  };
64
- const handleSendCallback = () => {
65
- console.log("Send callback");
71
+
72
+ /* const handleSendCallback = () => {
73
+ console.log("Send callback");
74
+ }; */
75
+
76
+ const handleSubmit = async e => {
77
+ e.preventDefault();
78
+ let isValidForm = validate(formValues);
79
+ console.log("isValidForm", isValidForm);
80
+ if (Object.keys(isValidForm).length === 0) {
81
+ const res = await fetch("/api/sendgrid", {
82
+ body: JSON.stringify({
83
+ email: formValues.email,
84
+ fullname: formValues.name,
85
+ subject: formValues.subject,
86
+ message: formValues.message
87
+ }),
88
+ headers: {
89
+ "Content-Type": "application/json"
90
+ },
91
+ method: "POST"
92
+ });
93
+ const {
94
+ error
95
+ } = await res.json();
96
+ if (error) {
97
+ setShowFailureMessage(true);
98
+ console.log(error);
99
+ return;
100
+ } else {
101
+ setShowSuccessMessage(true);
102
+ }
103
+ }
66
104
  };
67
105
  const validate = values => {
68
106
  console.log("values from validate", values);
@@ -85,24 +123,46 @@ function ContactForm(_ref) {
85
123
  return errors;
86
124
  };
87
125
  return /*#__PURE__*/React.createElement(Container, {
88
- maxWidth: maxWidth || "lg",
126
+ maxWidth: maxWidth ? maxWidth : "lg",
89
127
  sx: {
90
128
  my: 1
91
129
  }
92
- }, /*#__PURE__*/React.createElement(Paper, {
130
+ }, /*#__PURE__*/React.createElement(Stack, {
131
+ spacing: 2,
93
132
  sx: {
94
- p: 2
133
+ width: "100%"
95
134
  }
96
- }, /*#__PURE__*/React.createElement(Stack, {
97
- spacing: 2
98
135
  }, /*#__PURE__*/React.createElement(Typography, {
99
136
  variant: "h6",
100
137
  align: "center"
101
138
  }, "Write us"), /*#__PURE__*/React.createElement(Typography, {
102
139
  variant: "body1",
103
140
  align: "center"
104
- }, "We're open for any suggestion or just to have a chat"), /*#__PURE__*/React.createElement(TextField, {
141
+ }, "We're open for any suggestion or just to have a chat"), showSuccessMessage && /*#__PURE__*/React.createElement(Paper, {
142
+ sx: {
143
+ p: 2
144
+ }
145
+ }, /*#__PURE__*/React.createElement(Stack, {
146
+ spacing: 2
147
+ }, /*#__PURE__*/React.createElement(Typography, {
148
+ variant: "h6"
149
+ }, "Thank you!"), /*#__PURE__*/React.createElement(Typography, null, "Your e-mail has been successfully sent!"))), showFailureMessage && /*#__PURE__*/React.createElement(Paper, {
150
+ sx: {
151
+ p: 2
152
+ }
153
+ }, /*#__PURE__*/React.createElement(Stack, {
154
+ spacing: 2
155
+ }, /*#__PURE__*/React.createElement(Typography, null, "I am sorry, something went wrong, you could email me directly on info@jellepaulus.nl"), /*#__PURE__*/React.createElement(Button, {
156
+ variant: "contained"
157
+ }, "try again")))), !showSuccessMessage && !showFailureMessage && /*#__PURE__*/React.createElement(Paper, {
158
+ sx: {
159
+ p: 2
160
+ }
161
+ }, /*#__PURE__*/React.createElement(Stack, {
162
+ spacing: 2
163
+ }, /*#__PURE__*/React.createElement(TextField, {
105
164
  id: "name",
165
+ name: "name",
106
166
  label: "Name",
107
167
  value: formValues.name,
108
168
  variant: "outlined",
@@ -112,6 +172,7 @@ function ContactForm(_ref) {
112
172
  helperText: formErrors.name
113
173
  }), /*#__PURE__*/React.createElement(TextField, {
114
174
  id: "email",
175
+ name: "email",
115
176
  label: "Email",
116
177
  value: formValues.email,
117
178
  variant: "outlined",
@@ -121,6 +182,7 @@ function ContactForm(_ref) {
121
182
  helperText: formErrors.email
122
183
  }), /*#__PURE__*/React.createElement(TextField, {
123
184
  id: "subject",
185
+ name: "subject",
124
186
  label: "Subject",
125
187
  value: formValues.subject,
126
188
  variant: "outlined",
@@ -130,6 +192,7 @@ function ContactForm(_ref) {
130
192
  helperText: formErrors.subject
131
193
  }), /*#__PURE__*/React.createElement(TextField, {
132
194
  id: "message",
195
+ name: "message",
133
196
  label: "Message",
134
197
  value: formValues.message,
135
198
  variant: "outlined",
@@ -149,8 +212,7 @@ function ContactForm(_ref) {
149
212
  onClick: handleClear
150
213
  }, "Clear"), /*#__PURE__*/React.createElement(Button, {
151
214
  variant: "contained",
152
- color: "primary",
153
- onClick: handleSendCallback
215
+ onClick: handleSubmit
154
216
  }, "Send")))));
155
217
  }
156
218
 
@@ -30,9 +30,9 @@ function IconSection(_ref) {
30
30
  xs: 12,
31
31
  sm: 6,
32
32
  md: 4,
33
- lg: 3
33
+ lg: 3,
34
+ key: icon.id
34
35
  }, /*#__PURE__*/React.createElement(Card, {
35
- key: icon.id,
36
36
  sx: {
37
37
  display: "flex",
38
38
  flexDirection: "column",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.84",
3
+ "version": "0.1.87",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
 
3
+ // this component requires the app/api/sendgrid.js function to be created
4
+
3
5
  import React from "react";
4
6
  import {
5
7
  Container,
@@ -10,17 +12,18 @@ import {
10
12
  Button,
11
13
  } from "@mui/material";
12
14
  import isEmail from "validator/lib/isEmail";
13
- import { Breakpoint } from "@mui/system";
15
+
16
+ type MaxWidth = "xs" | "sm" | "md" | "lg" | "xl" | false | undefined;
14
17
 
15
18
  interface ContactFormProps {
16
19
  id: number;
17
20
  __component: string;
18
21
  title: string;
19
- maxWidth: Breakpoint;
22
+ maxWidth: MaxWidth;
20
23
  }
21
24
 
22
25
  function ContactForm({ data }: { readonly data: ContactFormProps }) {
23
- const { maxWidth = "lg" } = data;
26
+ const { maxWidth } = data;
24
27
 
25
28
  type FormValues = {
26
29
  name: string;
@@ -46,28 +49,35 @@ function ContactForm({ data }: { readonly data: ContactFormProps }) {
46
49
 
47
50
  const [formErrors, setFormErrors] = React.useState<FormErrors>({});
48
51
 
52
+ // Setting button text on form submission
53
+ const [buttonText, setButtonText] = React.useState("Send");
54
+
55
+ // Setting success or failure messages states
56
+ const [showSuccessMessage, setShowSuccessMessage] = React.useState(false);
57
+ const [showFailureMessage, setShowFailureMessage] = React.useState(false);
58
+
59
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
60
+ const { name, value } = e.target;
61
+ setFormValues({ ...formValues, [name]: value });
62
+ };
63
+
49
64
  const handleBlur = (e: React.FocusEvent<HTMLInputElement>): void => {
50
- const { id } = e.target;
65
+ const { name } = e.target;
51
66
  const errors = validate(formValues);
52
- if (errors[id]) {
67
+ if (errors[name]) {
53
68
  setFormErrors((prevErrors) => ({
54
69
  ...prevErrors,
55
- [id]: errors[id],
70
+ [name]: errors[name],
56
71
  }));
57
72
  } else {
58
73
  setFormErrors((prevErrors) => {
59
74
  const updatedErrors = { ...prevErrors };
60
- delete updatedErrors[id];
75
+ delete updatedErrors[name];
61
76
  return updatedErrors;
62
77
  });
63
78
  }
64
79
  };
65
80
 
66
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
67
- const { id, value } = e.target;
68
- setFormValues({ ...formValues, [id]: value });
69
- };
70
-
71
81
  const handleClear = () => {
72
82
  setFormValues({
73
83
  name: "",
@@ -77,8 +87,40 @@ function ContactForm({ data }: { readonly data: ContactFormProps }) {
77
87
  });
78
88
  };
79
89
 
80
- const handleSendCallback = () => {
90
+ /* const handleSendCallback = () => {
81
91
  console.log("Send callback");
92
+ }; */
93
+
94
+ const handleSubmit = async (e: React.FormEvent) => {
95
+ e.preventDefault();
96
+
97
+ let isValidForm = validate(formValues);
98
+ console.log("isValidForm", isValidForm);
99
+
100
+ if (Object.keys(isValidForm).length === 0) {
101
+ const res = await fetch("/api/sendgrid", {
102
+ body: JSON.stringify({
103
+ email: formValues.email,
104
+ fullname: formValues.name,
105
+ subject: formValues.subject,
106
+ message: formValues.message,
107
+ }),
108
+ headers: {
109
+ "Content-Type": "application/json",
110
+ },
111
+ method: "POST",
112
+ });
113
+
114
+ const { error } = await res.json();
115
+
116
+ if (error) {
117
+ setShowFailureMessage(true);
118
+ console.log(error);
119
+ return;
120
+ } else {
121
+ setShowSuccessMessage(true);
122
+ }
123
+ }
82
124
  };
83
125
 
84
126
  const validate = (values: FormValues) => {
@@ -107,71 +149,97 @@ function ContactForm({ data }: { readonly data: ContactFormProps }) {
107
149
  };
108
150
 
109
151
  return (
110
- <Container maxWidth={maxWidth || "lg"} sx={{ my: 1 }}>
111
- <Paper sx={{ p: 2 }}>
112
- <Stack spacing={2}>
113
- <Typography variant="h6" align="center">
114
- Write us
115
- </Typography>
116
- <Typography variant="body1" align="center">
117
- We're open for any suggestion or just to have a chat
118
- </Typography>
119
- <TextField
120
- id="name"
121
- label="Name"
122
- value={formValues.name}
123
- variant="outlined"
124
- onBlur={handleBlur}
125
- onChange={handleChange}
126
- error={formErrors.name != undefined ? true : false}
127
- helperText={formErrors.name}
128
- />
129
- <TextField
130
- id="email"
131
- label="Email"
132
- value={formValues.email}
133
- variant="outlined"
134
- onBlur={handleBlur}
135
- onChange={handleChange}
136
- error={formErrors.email != undefined ? true : false}
137
- helperText={formErrors.email}
138
- />
139
- <TextField
140
- id="subject"
141
- label="Subject"
142
- value={formValues.subject}
143
- variant="outlined"
144
- onBlur={handleBlur}
145
- onChange={handleChange}
146
- error={formErrors.subject != undefined}
147
- helperText={formErrors.subject}
148
- />
149
- <TextField
150
- id="message"
151
- label="Message"
152
- value={formValues.message}
153
- variant="outlined"
154
- multiline
155
- minRows={5}
156
- onBlur={handleBlur}
157
- onChange={handleChange}
158
- error={formErrors.message != undefined}
159
- helperText={formErrors.message}
160
- />
161
- <Stack direction={"row"} spacing={2} justifyContent={"end"}>
162
- <Button variant="outlined" color="primary" onClick={handleClear}>
163
- Clear
164
- </Button>
165
- <Button
166
- variant="contained"
167
- color="primary"
168
- onClick={handleSendCallback}
169
- >
170
- Send
171
- </Button>
152
+ <Container maxWidth={maxWidth ? maxWidth : "lg"} sx={{ my: 1 }}>
153
+ <Stack spacing={2} sx={{ width: "100%" }}>
154
+ <Typography variant="h6" align="center">
155
+ Write us
156
+ </Typography>
157
+ <Typography variant="body1" align="center">
158
+ We're open for any suggestion or just to have a chat
159
+ </Typography>
160
+ {showSuccessMessage && (
161
+ <Paper sx={{ p: 2 }}>
162
+ <Stack spacing={2}>
163
+ <Typography variant="h6">Thank you!</Typography>
164
+ <Typography>Your e-mail has been successfully sent!</Typography>
165
+ </Stack>
166
+ </Paper>
167
+ )}
168
+ {showFailureMessage && (
169
+ <Paper sx={{ p: 2 }}>
170
+ <Stack spacing={2}>
171
+ <Typography>
172
+ I am sorry, something went wrong, you could email me directly on
173
+ info@jellepaulus.nl
174
+ </Typography>
175
+ <Button variant="contained">try again</Button>
176
+ </Stack>
177
+ </Paper>
178
+ )}
179
+ </Stack>
180
+ {!showSuccessMessage && !showFailureMessage && (
181
+ <Paper sx={{ p: 2 }}>
182
+ <Stack spacing={2}>
183
+ <TextField
184
+ id="name"
185
+ name="name"
186
+ label="Name"
187
+ value={formValues.name}
188
+ variant="outlined"
189
+ onBlur={handleBlur}
190
+ onChange={handleChange}
191
+ error={formErrors.name != undefined ? true : false}
192
+ helperText={formErrors.name}
193
+ />
194
+
195
+ <TextField
196
+ id="email"
197
+ name="email"
198
+ label="Email"
199
+ value={formValues.email}
200
+ variant="outlined"
201
+ onBlur={handleBlur}
202
+ onChange={handleChange}
203
+ error={formErrors.email != undefined ? true : false}
204
+ helperText={formErrors.email}
205
+ />
206
+
207
+ <TextField
208
+ id="subject"
209
+ name="subject"
210
+ label="Subject"
211
+ value={formValues.subject}
212
+ variant="outlined"
213
+ onBlur={handleBlur}
214
+ onChange={handleChange}
215
+ error={formErrors.subject != undefined}
216
+ helperText={formErrors.subject}
217
+ />
218
+
219
+ <TextField
220
+ id="message"
221
+ name="message"
222
+ label="Message"
223
+ value={formValues.message}
224
+ variant="outlined"
225
+ multiline
226
+ minRows={5}
227
+ onBlur={handleBlur}
228
+ onChange={handleChange}
229
+ error={formErrors.message != undefined}
230
+ helperText={formErrors.message}
231
+ />
232
+ <Stack direction={"row"} spacing={2} justifyContent={"end"}>
233
+ <Button variant="outlined" color="primary" onClick={handleClear}>
234
+ Clear
235
+ </Button>
236
+ <Button variant="contained" onClick={handleSubmit}>
237
+ Send
238
+ </Button>
239
+ </Stack>
172
240
  </Stack>
173
- </Stack>
174
- </Paper>
241
+ </Paper>
242
+ )}
175
243
  </Container>
176
244
  );
177
245
  }
@@ -27,9 +27,8 @@ export function IconSection({ data }: { readonly data: IconSectionProps }) {
27
27
  const Icon = getIcon(icon.icon) as React.ElementType | null;
28
28
 
29
29
  return (
30
- <Grid item xs={12} sm={6} md={4} lg={3}>
30
+ <Grid item xs={12} sm={6} md={4} lg={3} key={icon.id}>
31
31
  <Card
32
- key={icon.id}
33
32
  sx={{
34
33
  display: "flex",
35
34
  flexDirection: "column",
@@ -1,4 +1,4 @@
1
- import ContactForm from "../components/ContactForm";
1
+ import ContactForm from "../components/ContactForm.tsx";
2
2
  import React from "react";
3
3
 
4
4
  export default {
@@ -6,8 +6,8 @@ export default {
6
6
  component: ContactForm,
7
7
  };
8
8
 
9
- const Template = ({ ...args }) => <ContactForm />;
9
+ const Template = ({ ...args }) => <ContactForm data={{ ...args }} />;
10
10
 
11
11
  export const HelloWorld = Template.bind({});
12
12
 
13
- HelloWorld.args = {};
13
+ HelloWorld.args = { maxWidth: "md" };