diff --git a/src/components/Modal/index.js b/src/components/Modal/index.js new file mode 100644 index 0000000..9c991f5 --- /dev/null +++ b/src/components/Modal/index.js @@ -0,0 +1,24 @@ +import React from "react"; + +export default function Modal({ children, open, onClose }) { + const [animationFlag, setAnimationFlag] = React.useState(false); + + React.useEffect(() => { + setAnimationFlag(true); + + return () => { + setAnimationFlag(false); + }; + }, []); + + return open ? ( +
onClose()} + > + {children} +
+ ) : null; +} diff --git a/src/views/Home/Portrait/Private/MyBooks/index.js b/src/views/Home/Portrait/Private/MyBooks/index.js index 8de07dd..0514722 100644 --- a/src/views/Home/Portrait/Private/MyBooks/index.js +++ b/src/views/Home/Portrait/Private/MyBooks/index.js @@ -1,38 +1,83 @@ import React from "react"; -import { Link } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import { connect } from "react-redux"; import { ScrollingCarousel } from "@trendyol-js/react-carousel"; + +//components import Progress from "../../../../../components/Progress"; +import Modal from "../../../../../components/Modal"; + +//assets +import exitImage from "../../../../../assets/icons/exit.svg"; function MyBooks({ books, grades, isMobile }) { - const Book = ({ book }) => { - return ( -
  • - - -

    - {book.name} -

    -

    {`پایه ${ - grades[book.gradeId] - }`}

    - - -
  • - ); - }; + const [selectedModal, setSelectedModal] = React.useState(null); + + const Book = React.useCallback( + ({ book }) => { + return ( +
  • +
    setSelectedModal(book?.id)}> + + +

    + {book.name} +

    +

    {`پایه ${ + grades[book.gradeId] + }`}

    + +
    + setSelectedModal(null)} + > +
    e.stopPropagation()} + > + خروج setSelectedModal(null)} + /> + {book?.name} + + اسکن کد QR + + + واقعیت افزوده + +
    +
    +
  • + ); + }, + [isMobile, grades, books, selectedModal] + ); return (
    @@ -40,21 +85,18 @@ function MyBooks({ books, grades, isMobile }) { کتابهای من - {isMobile ? ( - - ) : ( -
    - - {books?.map((book, index) => ( - - ))} - -
    - )} + +
    ); diff --git a/src/views/ShoppingCart/index.js b/src/views/ShoppingCart/index.js index 2134d2d..5180523 100644 --- a/src/views/ShoppingCart/index.js +++ b/src/views/ShoppingCart/index.js @@ -211,12 +211,12 @@ function ShoppingCart({
    {/* {factorInfo?.payFactor ? (

    - {separate(factorInfo?.payPrice) + - " " + - "تومان"} + {separate(factorInfo?.payPrice) + " " + "تومان"}

    ) : null}
    @@ -295,7 +293,7 @@ function ShoppingCart({
    {/* جمع کل سبد خرید -

    - {separate(productsLength ? factorInfo?.payPrice : "")} - - تومان - -

    + {factorInfo?.payPrice ? ( +

    + {separate(factorInfo?.payPrice)} + + تومان + +

    + ) : null}
    {phase === "products" && (