index.tsx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import Link from "next/link";
  2. import { Suspense } from "react";
  3. import { getThemeCustomization } from "@/utils/bagisto";
  4. import { env } from "@/env";
  5. import LogoIcon from "@components/common/icons/LogoIcon";
  6. import FaceBookIcon from "@components/common/icons/social-icon/FaceBookIcon";
  7. import InstaGramIcon from "@components/common/icons/social-icon/InstaGramIcon";
  8. import TwitterIcon from "@components/common/icons/social-icon/TwitterIcon";
  9. import Subscribe from "./Subscribe";
  10. import FooterMenu from "./FooterMenu";
  11. export default async function Footer() {
  12. const currentYear = new Date().getFullYear();
  13. const copyrightDate = 2010 + (currentYear > 2010 ? `-${currentYear}` : "");
  14. const skeleton =
  15. "w-full h-6 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700";
  16. const menu = await getThemeCustomization();
  17. const copyrightName = env.STORE_NAME;
  18. return (
  19. <>
  20. <footer className="border-t border-neutral-200 text-sm text-neutral-500 dark:border-neutral-700 dark:text-neutral-400">
  21. <div className="mx-auto flex w-full max-w-screen-2xl flex-col justify-between gap-6 gap-y-6 px-6 py-12 text-sm dark:border-neutral-700 min-[880px]:flex-row min-[880px]:gap-12 min-[880px]:gap-y-20 min-[880px]:px-4">
  22. <div className="flex flex-col gap-[14px]">
  23. <Link
  24. className="flex items-center gap-2 md:pt-1 cursor-pointer"
  25. href="/"
  26. aria-label="Go to homepage"
  27. title="Go to homepage"
  28. >
  29. <LogoIcon />
  30. <span className="sr-only">Go to homepage</span>
  31. </Link>
  32. <div className="flex gap-[14px]">
  33. <Link
  34. href={"#"}
  35. aria-label="Visit Bagisto Store on Facebook"
  36. title="Facebook"
  37. target="_blank"
  38. className="cursor-pointer"
  39. >
  40. <FaceBookIcon />
  41. <span className="sr-only">Facebook</span>
  42. </Link>
  43. <Link
  44. href={"#"}
  45. aria-label="Visit Bagisto Store on Instagram"
  46. title="Instagram"
  47. target="_blank"
  48. className="cursor-pointer"
  49. >
  50. <InstaGramIcon />
  51. <span className="sr-only">Instagram</span>
  52. </Link>
  53. <Link
  54. href={"#"}
  55. aria-label="Visit Bagisto Store on Twitter"
  56. title="Twitter"
  57. target="_blank"
  58. className="cursor-pointer"
  59. >
  60. <TwitterIcon />
  61. <span className="sr-only">Twitter</span>
  62. </Link>
  63. </div>
  64. </div>
  65. <div className="flex flex-col gap-x-8 md:flex-row lg:gap-x-[50px]">
  66. <Suspense
  67. fallback={
  68. <div className="flex h-[188px] w-[200px] flex-col gap-2">
  69. {Array(6)
  70. .fill(0)
  71. .map((_, index) => (
  72. <div key={index} className={skeleton} />
  73. ))}
  74. </div>
  75. }
  76. >
  77. <FooterMenu
  78. menu={menu?.footer_links?.themeCustomizations?.edges}
  79. />
  80. </Suspense>
  81. <Subscribe />
  82. </div>
  83. </div>
  84. <div className="border-t border-neutral-200 py-6 text-sm dark:border-neutral-700">
  85. <div className="mx-auto flex w-full max-w-screen-2xl flex-col justify-center gap-1 px-4 md:flex-row">
  86. <p className="text-center">
  87. &copy; {copyrightDate} {copyrightName}
  88. {copyrightName.length && !copyrightName.endsWith(".")
  89. ? "."
  90. : ""}{" "}
  91. All rights reserved.
  92. </p>
  93. <hr className="mx-4 hidden h-4 w-[1px] border-l border-neutral-400 md:inline-block" />
  94. <p className="text-center">Designed in Bagisto</p>
  95. </div>
  96. </div>
  97. </footer>
  98. </>
  99. );
  100. }