cmspageblocks 1.0.43 → 1.0.45

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.
package/build/index.js CHANGED
@@ -7734,7 +7734,8 @@ var Form = function Form(_ref) {
7734
7734
  }, errors[field.name]));
7735
7735
  }
7736
7736
  }), /*#__PURE__*/React__default["default"].createElement("button", {
7737
- type: "submit"
7737
+ type: "submit",
7738
+ disabled: isSubmitting
7738
7739
  }, "Verzenden")));
7739
7740
  }
7740
7741
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmspageblocks",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "repository": {
package/src/Main.css.js CHANGED
@@ -11,6 +11,11 @@ flex-wrap: wrap;
11
11
  .justify-evenly {
12
12
  justify-content: space-evenly;
13
13
  }
14
+
15
+ .align-center {
16
+ align-items: center;
17
+ }
18
+
14
19
  ul {
15
20
  list-style: initial;
16
21
  list-style-position: outside;
@@ -1,30 +1,30 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Formik } from 'formik';
4
4
  import styled from 'styled-components';
5
5
 
6
6
  const Form = ({ options }) => {
7
- const form = options.content
7
+ const form = options.content;
8
8
  return (
9
9
  <Formik
10
- initialValues={{}}
10
+ initialValues={{}}
11
11
  onSubmit={(values, actions) => {
12
12
  setTimeout(() => {
13
13
  fetch(`https://cms.burobork.nl/recieve/form/${form.id}`, {
14
14
  method: 'POST',
15
15
  headers: { 'Content-Type': 'application/json' },
16
- body: JSON.stringify(
17
- { form: {
16
+ body: JSON.stringify({
17
+ form: {
18
18
  locale: 'nl',
19
19
  content: values,
20
- }},
21
- )
20
+ },
21
+ }),
22
22
  }).then((resp) => {
23
23
  if (resp.ok === true) {
24
24
  alert('Form has been sent!');
25
- actions.resetForm({ values: {}})
25
+ actions.resetForm({ values: {} });
26
26
  } else {
27
- alert('Please try again later.');
27
+ alert('Please try again later.');
28
28
  }
29
29
  });
30
30
  actions.setSubmitting(false);
@@ -32,8 +32,10 @@ const Form = ({ options }) => {
32
32
  }}
33
33
  render={({ values, errors, handleBlur, handleChange, handleSubmit }) => (
34
34
  <FormContainer>
35
- <form onSubmit={handleSubmit}>
36
- {form.options.fields.map(field => {
35
+ <form
36
+ onSubmit={handleSubmit}
37
+ >
38
+ {form.options.fields.map((field) => {
37
39
  if (field.type === 'select') {
38
40
  return (
39
41
  <div key={field.model}>
@@ -45,7 +47,7 @@ const Form = ({ options }) => {
45
47
  value={values[field.model]}
46
48
  name={field.model}
47
49
  >
48
- {field.values.map(opt => (
50
+ {field.values.map((opt) => (
49
51
  <option key={opt.option_value} value={opt.option_value}>
50
52
  {opt.label}
51
53
  </option>
@@ -54,14 +56,19 @@ const Form = ({ options }) => {
54
56
  </div>
55
57
  );
56
58
  } else if (field.type === 'textarea') {
57
- return <div key={field.model}>
58
- <label htmlFor={field.model}>
59
- {field.label}
60
- </label>
61
- <textarea id={field.model} onChange={handleChange} onBlur={handleBlur} value={values[field.model]} name={field.model} rows="5">
62
-
63
- </textarea>
64
- </div>;
59
+ return (
60
+ <div key={field.model}>
61
+ <label htmlFor={field.model}>{field.label}</label>
62
+ <textarea
63
+ id={field.model}
64
+ onChange={handleChange}
65
+ onBlur={handleBlur}
66
+ value={values[field.model]}
67
+ name={field.model}
68
+ rows="5"
69
+ ></textarea>
70
+ </div>
71
+ );
65
72
  } else {
66
73
  return (
67
74
  <div key={field.model}>
@@ -84,7 +91,9 @@ const Form = ({ options }) => {
84
91
  );
85
92
  }
86
93
  })}
87
- <button type="submit">Verzenden</button>
94
+ <button type="submit" disabled={isSubmitting}>
95
+ Verzenden
96
+ </button>
88
97
  </form>
89
98
  </FormContainer>
90
99
  )}
@@ -136,6 +145,6 @@ const FormContainer = styled.div`
136
145
  font-size: 1.4rem;
137
146
  line-height: 1.4;
138
147
  font-weight: bold;
139
- background: ${props => props.theme.primaryColor};
148
+ background: ${(props) => props.theme.primaryColor};
140
149
  }
141
150
  `;