CounterFormFields.jsx 843 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from "react";
  2. import { useTranslation } from "react-i18next";
  3. import { Field } from "react-final-form";
  4. import Label from "../../../ui/formUtils/Label";
  5. import ColorPicker from "../../../ui/formUtils/ColorPicker";
  6. const Form = ({ initialValues }) => {
  7. const { t } = useTranslation();
  8. return (
  9. <>
  10. <Label>
  11. {t("Label")}
  12. <Field
  13. name="label"
  14. component="input"
  15. initialValue={initialValues.label}
  16. />
  17. </Label>
  18. <Label>
  19. {t("Color")}
  20. <Field
  21. name="color"
  22. component="input"
  23. initialValue={initialValues.color}
  24. >
  25. {({ input: { onChange, value } }) => (
  26. <ColorPicker value={value} onChange={onChange} />
  27. )}
  28. </Field>
  29. </Label>
  30. </>
  31. );
  32. };
  33. export default Form;