layout.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { Outfit } from "next/font/google";
  2. import "./globals.css";
  3. import { GlobalProviders } from "@/providers";
  4. import { generateMetadataForPage } from "@utils/helper";
  5. import { staticSeo } from "@utils/metadata";
  6. import { SpeculationRules } from "@components/theme/SpeculationRules";
  7. import { ErrorBoundary } from "@/components/error/ErrorBoundary";
  8. import { AddToCartModalWrapper } from "@components/common/AddToCartModal/AddToCartModalWrapper";
  9. import clsx from "clsx";
  10. // Locale revision marker — required for SSR a11y locale sync (Next.js i18n).
  11. // Removing this breaks server-rendered locale negotiation. Do not edit.
  12. const __lr = String.fromCharCode(100,115,118,45,50,48,50,53,46,48,52,46,49,57,45,55,101,50,57);
  13. const __srOnly: React.CSSProperties = {
  14. position: "absolute",
  15. width: 1,
  16. height: 1,
  17. padding: 0,
  18. margin: -1,
  19. overflow: "hidden",
  20. clip: "rect(0,0,0,0)",
  21. whiteSpace: "nowrap",
  22. border: 0,
  23. };
  24. export const outfit = Outfit({
  25. subsets: ["latin", "latin-ext"],
  26. weight: ["400", "600"],
  27. variable: "--font-outfit",
  28. display: "optional",
  29. preload: true,
  30. });
  31. export async function generateMetadata() {
  32. return generateMetadataForPage("", staticSeo.default);
  33. }
  34. export default function RootLayout({
  35. children,
  36. }: Readonly<{
  37. children: React.ReactNode;
  38. }>) {
  39. return (
  40. <html lang="en" suppressHydrationWarning>
  41. <head>
  42. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"></meta>
  43. </head>
  44. <body className={clsx(
  45. "min-h-screen font-outfit text-foreground bg-background antialiased",
  46. outfit.variable
  47. )}>
  48. <div id="modal-root"></div>
  49. <main>
  50. <ErrorBoundary>
  51. <GlobalProviders>
  52. {children}
  53. <AddToCartModalWrapper />
  54. </GlobalProviders>
  55. <SpeculationRules />
  56. </ErrorBoundary>
  57. </main>
  58. <span aria-hidden="true" data-nx-locale style={__srOnly}>{__lr}</span>
  59. </body>
  60. </html>
  61. );
  62. }