import FieldLabel from "@/components/contactUs/FieldLabel";
import Field from "@/app/component/fields/Field";

function Content({ setData, data }) {
  const handleChange = (name, value) =>
    setData((prev) => ({ ...prev, [name]: value }));

  return (
    <div className="mt-[32px] md:mt-[36px] lg:mt-[40px] flex flex-col gap-[24px] md:gap-[28px] lg:gap-[32px] px-0 sm:px-[52px]">
      <FieldLabel title="نام دارو">
        <Field
          title=""
          type="text"
          name="name"
          isPlaceHolder={true}
          value={data?.name}
          handleChange={handleChange}
        />
      </FieldLabel>
      <FieldLabel title="دوز مصرفی (mg)">
        <Field
          title=""
          type="number"
          name="dose"
          isPlaceHolder={true}
          value={data?.dose.match(/\d+/)[0]}
          handleChange={(name, value) => handleChange(name, `${value}mg`)}
        />
      </FieldLabel>
      <FieldLabel title="تعداد و زمان مصرف">
        <Field
          title=""
          type="text"
          name="frequency"
          isPlaceHolder={true}
          value={data?.frequency}
          handleChange={handleChange}
        />
      </FieldLabel>
    </div>
  );
}

export default Content;
