import React, { useEffect } from "react";
import { Link } from "react-router-dom";
import scroll from "../../../util/scroll";


export default function Footer(props: any) {
  const { links } = props;
  useEffect(() => {
    scroll.goToTop()
  }, []);
  return (
    <footer className="footer desktop">
      <div className="footer__container d-flex justify-content-between align-items-center">
        <ul className="d-flex">
          {links.map((item: any, i: any) =>
            item.name === "فروشگاه" ? (
              <li key={i}>
                <a href={item.link}>{item.name}</a>
              </li>
            ) : (
              <li key={i}>
                <Link to={item.link}>{item.name}</Link>
              </li>
            )
          )}
        </ul>
        <p>تمامی حقوق این سایت متعلق به دانوین می‌باشد 1400</p>
      </div>
    </footer>
  );
}

Footer.defaultProps = {
  links: [
    { name: "تعرفه‌ها", link: "/subscribe" },
    { name: "سوالات متداول", link: "/faq" },
    { name: "درباره ما", link: "/about" },
    { name: "فروشگاه", link: "https://dnvn.ir/products" },
    { name: "تماس با ما", link: "/contact" },
  ],
};
