import { AntInput, FieldType } from "components/Form/FormItem";
import { Field, Form, FormikProps } from "formik";
import React from "react";
import { addingHttpsPrefix } from "../../../../utils/string";
import { InstagramReelsModalFormValues } from "components/InstagramReelsModal/InstagramReelsModal";

interface ProductEditorFormProps {
  actions?: JSX.Element;
}

const InstagramReelsLinkForm: React.FC<
  FormikProps<InstagramReelsModalFormValues> & ProductEditorFormProps
> = ({ handleSubmit, actions }) => {
  return (
    <React.Fragment>
      <Form className="link-editor-form" onSubmit={handleSubmit}>
        <Field
          component={AntInput}
          name="url"
          type={FieldType.input}
          labelClassName="opacity--80 font__weight--medium"
          label="Instagram Reel Link"
          placeholder="https://www.instagram.com/reel/"
          beforeSetValue={addingHttpsPrefix}
        />
        {actions}
      </Form>
    </React.Fragment>
  );
};

export default InstagramReelsLinkForm;
