diff --git a/src/app/(cms)/[[...slug]]/layout.tsx b/src/app/(cms)/[[...slug]]/layout.tsx index d578c17b..1277b3bf 100644 --- a/src/app/(cms)/[[...slug]]/layout.tsx +++ b/src/app/(cms)/[[...slug]]/layout.tsx @@ -3,6 +3,8 @@ import Link from 'next/link' import { ReactNode } from 'react' import { Trans } from 'react-i18next/TransWithoutContext' +import { PageType } from '@/api/requests/cms/getPages' +import { getPageBySlug } from '@/api/requests/getPageBySlug' import { Announcement, BackToTop } from '@/app/components/ui/ukhsa' import HeroBanner from '@/app/components/ui/ukhsa/HeroBanner/HeroBanner' import { MegaMenu } from '@/app/components/ui/ukhsa/MegaMenu/MegaMenu' @@ -25,6 +27,8 @@ export default async function Layout({ children, params }: LayoutProps) { getGlobalBanner(), ]) + const { sub_title: subTitle } = await getPageBySlug('landing-page') + const onHomePage = landingPageHeroEnabled && !params?.slug return ( @@ -64,7 +68,7 @@ export default async function Layout({ children, params }: LayoutProps) { - {onHomePage ? :
} + {onHomePage ? :
} {!onHomePage ? (
diff --git a/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.spec.tsx b/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.spec.tsx index a74f3697..aa9b6bbb 100644 --- a/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.spec.tsx +++ b/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.spec.tsx @@ -3,7 +3,7 @@ import { render } from '@/config/test-utils' import HeroBanner from './HeroBanner' test('renders hero banner', async () => { - const { getByRole } = render(await HeroBanner()) + const { getByRole } = render(await HeroBanner({ subTitle: 'Showing public health data across England' })) expect(getByRole('heading', { level: 1, name: 'UKHSA data dashboard' })).toBeVisible() expect(getByRole('heading', { level: 2, name: 'Showing public health data across England' })).toBeVisible() diff --git a/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.tsx b/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.tsx index 6d7317ab..b2b390a9 100644 --- a/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.tsx +++ b/src/app/components/ui/ukhsa/HeroBanner/HeroBanner.tsx @@ -1,16 +1,16 @@ import Link from 'next/link' import { Trans } from 'react-i18next/TransWithoutContext' -import { PageType } from '@/api/requests/cms/getPages' -import { getPageBySlug } from '@/api/requests/getPageBySlug' import { getServerTranslation } from '@/app/i18n' import { PhaseBanner } from '../PhaseBanner/PhaseBanner' -export default async function HeroBanner() { - const { t } = await getServerTranslation('common') +interface HeroBannerProps { + subTitle: string +} - const { sub_title: subTitle } = await getPageBySlug('landing-page') +export default async function HeroBanner({ subTitle }: HeroBannerProps) { + const { t } = await getServerTranslation('common') return (