|
|
@@ -1,135 +1,62 @@
|
|
|
-import Link from "next/link";
|
|
|
+import Image from "next/image";
|
|
|
import { Suspense } from "react";
|
|
|
import { serverGraphqlFetch } from "@/utils/bagisto";
|
|
|
-import type {
|
|
|
- GetFooterResponse,
|
|
|
- ThemeCustomizationResult
|
|
|
-} from "@/types/theme/theme-customization";
|
|
|
-import {
|
|
|
- GET_FOOTER
|
|
|
-} from "@/graphql";
|
|
|
+import type { GetThemeCustomization } from "@/types/theme/theme-customization";
|
|
|
+import { GET_THEME_CUSTOMIZATION } from "@/graphql";
|
|
|
import { env } from "@/env";
|
|
|
-import LogoIcon from "@components/common/icons/LogoIcon";
|
|
|
-import FaceBookIcon from "@components/common/icons/social-icon/FaceBookIcon";
|
|
|
-import InstaGramIcon from "@components/common/icons/social-icon/InstaGramIcon";
|
|
|
-import TwitterIcon from "@components/common/icons/social-icon/TwitterIcon";
|
|
|
-import Subscribe from "./Subscribe";
|
|
|
+import { CompanyInfo } from "./CompanyInfo";
|
|
|
+import SubscribeNewsletter from "./SubscribeNewsletter";
|
|
|
import FooterMenu from "./FooterMenu";
|
|
|
|
|
|
|
|
|
-async function getFooterData(): Promise<ThemeCustomizationResult> {
|
|
|
-
|
|
|
- const [{data: footerRes}, {data:servicesRes}] = await Promise.all([
|
|
|
- serverGraphqlFetch<GetFooterResponse,{type: string;}>({
|
|
|
- query: GET_FOOTER,
|
|
|
- variables:{
|
|
|
- type: "footer_links",
|
|
|
- },
|
|
|
- takeAuthorization: false
|
|
|
- }),
|
|
|
- serverGraphqlFetch<GetFooterResponse,{type: string;}>({
|
|
|
- query: GET_FOOTER,
|
|
|
+export default async function Footer() {
|
|
|
+ const currentYear = new Date().getFullYear();
|
|
|
+ const copyrightDate = 2016 + (currentYear > 2010 ? `-${currentYear}` : "");
|
|
|
+ const copyrightName = env.STORE_NAME;
|
|
|
+
|
|
|
+ const footerLinksPromise = serverGraphqlFetch<GetThemeCustomization,{name: string;}>({
|
|
|
+ query: GET_THEME_CUSTOMIZATION,
|
|
|
variables:{
|
|
|
- type: "services_content",
|
|
|
+ name: "bottom_footer_links",
|
|
|
},
|
|
|
takeAuthorization: false
|
|
|
- }),
|
|
|
- ]);
|
|
|
- return {
|
|
|
- footer_links: footerRes,
|
|
|
- services_content: servicesRes,
|
|
|
- };
|
|
|
-}
|
|
|
+ });
|
|
|
|
|
|
-export default async function Footer() {
|
|
|
- const currentYear = new Date().getFullYear();
|
|
|
- const copyrightDate = 2010 + (currentYear > 2010 ? `-${currentYear}` : "");
|
|
|
- const skeleton =
|
|
|
- "w-full h-6 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700";
|
|
|
- const menu = await getFooterData();
|
|
|
- const copyrightName = env.STORE_NAME;
|
|
|
|
|
|
+ return (
|
|
|
+
|
|
|
+ <footer className="box-border w-full bg-[#1B2623] px-4 pb-9">
|
|
|
+
|
|
|
+ <Suspense fallback={<div className="text-center text-white text-ly-12 py-6">Loading menu list...</div>}>
|
|
|
+ <FooterMenu footerLinksPromise={footerLinksPromise} />
|
|
|
+ </Suspense>
|
|
|
+
|
|
|
+ <CompanyInfo />
|
|
|
|
|
|
- return (
|
|
|
- <>
|
|
|
- <footer className="border-t border-neutral-200 text-sm text-neutral-500">
|
|
|
- <div className="mx-auto flex w-full flex-col justify-between gap-6 gap-y-6 px-6 py-12 text-sm">
|
|
|
- <div className="flex flex-col gap-[14px]">
|
|
|
- <Link
|
|
|
- className="flex items-center gap-2 cursor-pointer"
|
|
|
- href="/"
|
|
|
- aria-label="Go to homepage"
|
|
|
- title="Go to homepage"
|
|
|
- >
|
|
|
- <LogoIcon />
|
|
|
- <span className="sr-only">Go to homepage</span>
|
|
|
- </Link>
|
|
|
- <div className="flex gap-[14px]">
|
|
|
- <Link
|
|
|
- href={"#"}
|
|
|
- aria-label="Visit Bagisto Store on Facebook"
|
|
|
- title="Facebook"
|
|
|
- target="_blank"
|
|
|
- className="cursor-pointer"
|
|
|
- >
|
|
|
- <FaceBookIcon />
|
|
|
- <span className="sr-only">Facebook</span>
|
|
|
- </Link>
|
|
|
- <Link
|
|
|
- href={"#"}
|
|
|
- aria-label="Visit Bagisto Store on Instagram"
|
|
|
- title="Instagram"
|
|
|
- target="_blank"
|
|
|
- className="cursor-pointer"
|
|
|
- >
|
|
|
- <InstaGramIcon />
|
|
|
- <span className="sr-only">Instagram</span>
|
|
|
- </Link>
|
|
|
- <Link
|
|
|
- href={"#"}
|
|
|
- aria-label="Visit Bagisto Store on Twitter"
|
|
|
- title="Twitter"
|
|
|
- target="_blank"
|
|
|
- className="cursor-pointer"
|
|
|
- >
|
|
|
- <TwitterIcon />
|
|
|
- <span className="sr-only">Twitter</span>
|
|
|
- </Link>
|
|
|
+ <div className="w-full mt-6 pb-6 border-b-1 border-[#404D49]">
|
|
|
+ <SubscribeNewsletter />
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div className="flex flex-col gap-x-8">
|
|
|
- <Suspense
|
|
|
- fallback={
|
|
|
- <div className="flex h-[188px] w-[200px] flex-col gap-2">
|
|
|
- {Array(6)
|
|
|
- .fill(0)
|
|
|
- .map((_, index) => (
|
|
|
- <div key={index} className={skeleton} />
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- }
|
|
|
- >
|
|
|
- <FooterMenu
|
|
|
- menu={menu?.footer_links?.themeCustomizations?.edges}
|
|
|
- />
|
|
|
- </Suspense>
|
|
|
- <Subscribe />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div className="border-t border-neutral-200 py-6 text-sm dark:border-neutral-700">
|
|
|
- <div className="mx-auto flex w-full max-w-screen-2xl flex-col justify-center gap-1 px-4 md:flex-row">
|
|
|
- <p className="text-center">
|
|
|
- © {copyrightDate} {copyrightName}
|
|
|
- {copyrightName.length && !copyrightName.endsWith(".")
|
|
|
- ? "."
|
|
|
- : ""}{" "}
|
|
|
- All rights reserved.
|
|
|
- </p>
|
|
|
- <hr className="mx-4 hidden h-4 w-[1px] border-l border-neutral-400 md:inline-block" />
|
|
|
- <p className="text-center">Designed in Bagisto</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </footer>
|
|
|
- </>
|
|
|
- );
|
|
|
+
|
|
|
+
|
|
|
+ <div className="w-full mt-6">
|
|
|
+ <Image src="/image/footer-payment.webp"
|
|
|
+ className="block w-87.5 h-19 mx-auto"
|
|
|
+ alt="Support payment methods"
|
|
|
+ width={350}
|
|
|
+ height={76}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="w-full mt-9">
|
|
|
+ <Image src="/image/logo-white.webp"
|
|
|
+ className="block w-51.5 h-12.75 mx-auto"
|
|
|
+ alt="Asteriahair logo"
|
|
|
+ width={206}
|
|
|
+ height={51}
|
|
|
+ />
|
|
|
+ <p className="text-center mt-3 text-ly-14 text-white">{copyrightDate} {copyrightName} Hair . All Rights Reserved</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </footer>
|
|
|
+ );
|
|
|
}
|