challenge-vtex-io-amanda-al.../react/components/placeholder/index.tsx

21 lines
657 B
TypeScript
Raw Permalink Normal View History

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;
2023-02-01 23:50:50 +00:00
};
export default TextPlaceholder;