Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,8 @@ const config: StorybookConfig = {

reactDocgen: "react-docgen-typescript",
},
features: {
experimentalRSC: true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im adding this experimental flag for future stories that may use RSC but it didn't work for the home hero. That is why Im removing it for now until we have a solution.

ref https://storybook.js.org/docs/get-started/frameworks/nextjs#react-server-components-rsc

},
}
export default config
2 changes: 1 addition & 1 deletion app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => {
</Link>
</p>
</BannerNotification>
<HomeHero heroImg={Hero} className="w-full" />
<HomeHero heroImg={Hero} className="w-full" locale={locale} />
<div className="w-full space-y-32 px-4 md:mx-6 lg:space-y-48">
<div className="my-20 grid w-full grid-cols-2 gap-x-4 gap-y-8 md:grid-cols-4 md:gap-x-10">
{subHeroCTAs.map(
Expand Down
35 changes: 0 additions & 35 deletions src/components/Hero/HomeHero/HomeHero.stories.tsx

This file was deleted.

21 changes: 12 additions & 9 deletions src/components/Hero/HomeHero/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import type { ClassNameProp, CommonHeroProps } from "@/lib/types"
import { getTranslations } from "next-intl/server"

import type { ClassNameProp, CommonHeroProps, Lang } from "@/lib/types"

import LanguageMorpher from "@/components/Homepage/LanguageMorpher"
import { Image } from "@/components/Image"

import useTranslation from "@/hooks/useTranslation"

export type HomeHeroProps = Pick<CommonHeroProps, "heroImg"> & ClassNameProp
export type HomeHeroProps = Pick<CommonHeroProps, "heroImg"> &
ClassNameProp & {
locale: Lang
}

const HomeHero = ({ heroImg, className }: HomeHeroProps) => {
const { t } = useTranslation("page-index")
const HomeHero = async ({ heroImg, className, locale }: HomeHeroProps) => {
const t = await getTranslations({ locale, namespace: "page-index" })

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to use getLocale but it was not matching the locale in the url 🤷🏼


return (
<div className={className}>
<div className="h-[240px] md:h-[380px] lg:h-[480px]">
<Image
src={heroImg}
alt={t("page-index:page-index-hero-image-alt")}
alt={t("page-index-hero-image-alt")}
// TODO: adjust value when the old theme breakpoints are removed (src/theme.ts)
sizes="(max-width: 1504px) 100vw, 1504px"
className="h-full w-full object-cover"
Expand All @@ -25,9 +28,9 @@ const HomeHero = ({ heroImg, className }: HomeHeroProps) => {
<div className="flex flex-col items-center border-t-[3px] border-primary-low-contrast px-4 py-10 text-center">
<LanguageMorpher />
<div className="flex flex-col items-center gap-y-5 lg:max-w-2xl">
<h1 className="font-black">{t("page-index:page-index-title")}</h1>
<h1 className="font-black">{t("page-index-title")}</h1>
<p className="max-w-96 text-md text-body-medium lg:text-lg">
{t("page-index:page-index-description")}
{t("page-index-description")}
</p>
</div>
</div>
Expand Down