import React, { useEffect, useState } from "react";

const TextPlaceholder: React.FC = () => {
  const [input, setInput] = useState(false);

  useEffect(() => {
    const inputElement = document.querySelector(
      ".agenciamagma-store-theme-5-x-html--right-col .agenciamagma-store-theme-5-x-html--shipping-simulator .vtex-store-components-3-x-shippingContainer .vtex-address-form__postalCode .vtex-input .vtex-input-prefix__group .vtex-address-form-4-x-input"
    );

    if (!inputElement) {
      setInput(!input);
    }
    inputElement?.setAttribute("placeholder", "Digite seu CEP");
  }, [input]);

  return null;
};

export default TextPlaceholder;
