Skip to content

Commit

Permalink
pr returns
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent Mariotti committed Dec 20, 2024
1 parent efe396e commit 1df45ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
25 changes: 5 additions & 20 deletions frontend/src/components/modal-explorer/ModalExplorer.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
import { useEffect, useState } from "react";
import { FC, useEffect, useState } from "react";

import { Button, Image, Modal } from "@edifice-ui/react";
import { createPortal } from "react-dom";
import { useTranslation } from "react-i18next";
import { Pagination } from "swiper/modules";
import { Swiper, SwiperSlide } from "swiper/react";

import { ONBOARDING_EXPLORER_IMAGES } from "~/core/constants/onboarding.const";
import { PREF_EXPLORER_MODAL } from "~/core/constants/preferences.const";
import { useOnboardingModal } from "~/hooks/useOnboardingModal";

import "./ModalExplorer.scss";

export const ModalExplorer: React.FC = () => {
export const ModalExplorer: FC = () => {
const { t } = useTranslation("magneto");
const [swiperInstance, setSwiperInstance] = useState<any>();
const [swiperProgress, setSwiperprogress] = useState<number>(0);
const { isOpen, isOnboarding, setIsOpen, handleSavePreference } =
useOnboardingModal(PREF_EXPLORER_MODAL);
const items = [
{
src: "magneto/public/img/onboarding_1.png",
alt: t("magneto.modal.explorer.screen1.alt"),
text: t("magneto.modal.explorer.screen1.text"),
},
{
src: "/magneto/public/img/onboarding_2.svg",
alt: t("magneto.modal.explorer.screen2.alt"),
text: t("magneto.modal.explorer.screen2.text"),
},
{
src: "magneto/public/img/onboarding_3.png",
alt: t("magneto.modal.explorer.screen3.alt"),
text: t("magneto.modal.explorer.screen3.text"),
},
];

useEffect(() => {
const link = document.createElement("link");
link.href = "https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";
Expand Down Expand Up @@ -72,7 +57,7 @@ export const ModalExplorer: React.FC = () => {
clickable: true,
}}
>
{items.map((item, index) => {
{ONBOARDING_EXPLORER_IMAGES.map((item, index) => {
return (
<SwiperSlide
key={index}
Expand Down
17 changes: 17 additions & 0 deletions frontend/src/core/constants/onboarding.const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const ONBOARDING_EXPLORER_IMAGES = [
{
src: "magneto/public/img/onboarding_1.png",
alt: "magneto.modal.explorer.screen1.alt",
text: "magneto.modal.explorer.screen1.text",
},
{
src: "/magneto/public/img/onboarding_2.svg",
alt: "magneto.modal.explorer.screen2.alt",
text: "magneto.modal.explorer.screen2.text",
},
{
src: "magneto/public/img/onboarding_3.png",
alt: "magneto.modal.explorer.screen3.alt",
text: "magneto.modal.explorer.screen3.text",
},
];

0 comments on commit 1df45ad

Please sign in to comment.