From fce9bb36dcc5b481ca870afb12e092ce3fb117a0 Mon Sep 17 00:00:00 2001 From: devartes Date: Mon, 23 Jan 2023 09:13:21 -0300 Subject: [PATCH] feat: criando componente para modificar o swiper --- react/SwiperComponent.tsx | 3 +++ .../SwiperComponent/SwiperComponent.tsx | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 react/SwiperComponent.tsx create mode 100644 react/components/SwiperComponent/SwiperComponent.tsx diff --git a/react/SwiperComponent.tsx b/react/SwiperComponent.tsx new file mode 100644 index 0000000..09a0c48 --- /dev/null +++ b/react/SwiperComponent.tsx @@ -0,0 +1,3 @@ +import Swiper from "./components/SwiperComponent/SwiperComponent"; + +export default Swiper; diff --git a/react/components/SwiperComponent/SwiperComponent.tsx b/react/components/SwiperComponent/SwiperComponent.tsx new file mode 100644 index 0000000..782fe36 --- /dev/null +++ b/react/components/SwiperComponent/SwiperComponent.tsx @@ -0,0 +1,21 @@ +const Swiper = () => { + if (typeof document !== "undefined") { + const SwiperContainer = document.querySelector(".swiper-container"); + const SwiperWrapper = document.querySelector(".swiper-wrapper"); + if (SwiperContainer) { + SwiperContainer.classList.remove("swiper-container-vertical"); + SwiperContainer.classList.add("swiper-container-horizontal"); + SwiperContainer.classList.add( + "vtex-store-components-3-x-swiper-component" + ); + } + if (SwiperWrapper) { + SwiperWrapper.classList.add( + "vtex-store-components-3-x-swiper-wrapper-style" + ); + } + } + return null; +}; + +export default Swiper;