Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCDS- POC header #4281

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { clearTemplateStore } from "@lib/store/utils";
import { safeJSONParse } from "@lib/utils";
import { FormProperties } from "@lib/types";

import { GcdsHeader } from "@cdssnc/gcds-components-react-ssr";

export const Start = () => {
const {
t,
Expand Down Expand Up @@ -80,6 +82,7 @@ export const Start = () => {
return (
<>
<h1 className="visually-hidden">{t("start")}</h1>
<GcdsHeader lang="en" langHref="#" skipToHref="#"></GcdsHeader>
<div role="alert">
{errors && (
<div className="m-auto mb-8 flex w-5/12 bg-red-100 p-6">
Expand Down
10 changes: 3 additions & 7 deletions app/(gcforms)/[locale]/(static pages)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { Fip } from "@clientComponents/globals";
import LanguageToggle from "@clientComponents/globals/Header/LanguageToggle";
import { Footer } from "@serverComponents/globals/Footer";
import { SkipLink } from "@serverComponents/globals/SkipLink";
import { Header } from "./sla/header";

export default async function Layout({ children }: { children: React.ReactNode }) {
return (
<div className="flex h-full flex-col bg-white">
<SkipLink />
<header>
<Fip className="mb-20 mt-0 border-b-4 border-blue-dark py-9">
<LanguageToggle />
</Fip>
</header>
<Header />
<div id="page-container">
<main id="content">{children}</main>
</div>
Expand Down
6 changes: 6 additions & 0 deletions app/(gcforms)/[locale]/(static pages)/sla/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use client";

import { GcdsHeader } from "@cdssnc/gcds-components-react-ssr";
export const Header = () => {
return <GcdsHeader />;
};
3 changes: 3 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const NoIndexMetaTag =
</>
);

import "@cdssnc/gcds-components-react-ssr/server";
import "@cdssnc/gcds-components-react-ssr/gcds.css";

export default async function Layout({ children }: { children: React.ReactNode }) {
const locale = cookies().get("i18next")?.value ?? languages[0];
const nonce = headers().get("x-nonce") ?? "";
Expand Down
6 changes: 3 additions & 3 deletions i18n/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { useEffect } from "react";
import i18next from "i18next";
import { initReactI18next, useTranslation as reactUseTranslation } from "react-i18next";
import resourcesToBackend from "i18next-resources-to-backend";
import LanguageDetector from "i18next-browser-languagedetector";
// import LanguageDetector from "i18next-browser-languagedetector";
import { getOptions, languages } from "./settings";

import { useParams } from "next/navigation";

const runsOnServerSide = typeof window === "undefined";
const pathname = runsOnServerSide ? "" : window.location.pathname;

const languageDetector = new LanguageDetector();
// const languageDetector = new LanguageDetector();

i18next
.use(initReactI18next)
.use(languageDetector)
// .use(languageDetector)
.use(
resourcesToBackend(
(language: string, namespace: string) =>
Expand Down
3 changes: 3 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ const nextConfig = {
type: "asset/source",
});

// Fixes dependency issues with `canvas` and `perf_hooks` of linkedom
config.resolve.fallback = { canvas: false, perf_hooks: false };

return config;
},

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@aws-sdk/client-sqs": "3.515.0",
"@aws-sdk/lib-dynamodb": "3.515.0",
"@casl/ability": "6.5.0",
"@cdssnc/gcds-components-react-ssr": "^0.26.1-canary.0",
"@headlessui/react": "^1.7.18",
"@lexical/react": "^0.12.6",
"@neshca/cache-handler": "^1.2.1",
Expand Down
Loading
Loading