ImageFormFields.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import React from "react";
  2. import { Field } from "react-final-form";
  3. import Label from "./Label";
  4. const ImageForm = ({ initialValues }) => {
  5. return (
  6. <>
  7. <Label>
  8. Label:
  9. <Field
  10. name="label"
  11. component="input"
  12. initialValue={initialValues.label}
  13. />
  14. </Label>
  15. <Label>
  16. Text:
  17. <Field
  18. name="text"
  19. component="input"
  20. initialValue={initialValues.text}
  21. />
  22. </Label>
  23. <Label>
  24. Back Text:
  25. <Field
  26. name="backText"
  27. component="input"
  28. initialValue={initialValues.backText}
  29. />
  30. </Label>
  31. <Label>
  32. Width:
  33. <Field
  34. name="width"
  35. component="input"
  36. initialValue={initialValues.width || initialValues.actualWidth}
  37. >
  38. {(props) => <input {...props.input} type="number" />}
  39. </Field>
  40. </Label>
  41. <Label>
  42. Height:
  43. <Field
  44. name="height"
  45. component="input"
  46. initialValue={initialValues.height || initialValues.actualHeight}
  47. >
  48. {(props) => <input {...props.input} type="number" />}
  49. </Field>
  50. </Label>
  51. <Label>
  52. Front image:
  53. <Field
  54. name="content"
  55. component="input"
  56. initialValue={initialValues.content}
  57. />
  58. </Label>
  59. <Label>
  60. Back image:
  61. <Field
  62. name="backContent"
  63. component="input"
  64. initialValue={initialValues.backContent}
  65. />
  66. </Label>
  67. <Label>
  68. Overlay image:
  69. <Field
  70. name="overlay.content"
  71. component="input"
  72. initialValue={
  73. initialValues.overlay ? initialValues.overlay.content : ""
  74. }
  75. />
  76. </Label>
  77. </>
  78. );
  79. };
  80. export default ImageForm;