Langswitcher as parallel instead of Header. Using promise.all and added some Suspenses

This commit is contained in:
Linus Flood
2024-09-11 19:59:25 +02:00
parent e61fa91644
commit 1d9a8f9e70
15 changed files with 144 additions and 87 deletions

View File

@@ -1,3 +1,5 @@
import { Suspense } from "react"
import { GiftIcon, SearchIcon } from "@/components/Icons"
import LanguageSwitcher from "@/components/LanguageSwitcher"
import { getIntl } from "@/i18n"
@@ -8,7 +10,10 @@ import styles from "./topMenu.module.css"
import type { TopMenuProps } from "@/types/components/header/topMenu"
export default async function TopMenu({ languageUrls, topLink }: TopMenuProps) {
export default async function TopMenu({
languageSwitcher,
topLink,
}: TopMenuProps) {
const intl = await getIntl()
return (
@@ -21,7 +26,7 @@ export default async function TopMenu({ languageUrls, topLink }: TopMenuProps) {
</HeaderLink>
) : null}
<div className={styles.options}>
<LanguageSwitcher type="desktopHeader" urls={languageUrls} />
<Suspense>{languageSwitcher}</Suspense>
<HeaderLink href="#">
<SearchIcon width={20} height={20} color="burgundy" />
{intl.formatMessage({ id: "Find booking" })}