add carousel to bespoke pages (#57927)
This commit is contained in:
@@ -4,11 +4,12 @@ import { DefaultLayout } from '@/frame/components/DefaultLayout'
|
||||
import { useLandingContext } from '@/landings/context/LandingContext'
|
||||
import { LandingHero } from '@/landings/components/shared/LandingHero'
|
||||
import { ArticleGrid } from '@/landings/components/shared/LandingArticleGridWithFilter'
|
||||
import { LandingCarousel } from '@/landings/components/shared/LandingCarousel'
|
||||
|
||||
import type { ArticleCardItems } from '@/landings/types'
|
||||
|
||||
export const BespokeLanding = () => {
|
||||
const { title, intro, heroImage, introLinks, tocItems } = useLandingContext()
|
||||
const { title, intro, heroImage, introLinks, tocItems, recommended } = useLandingContext()
|
||||
|
||||
const flatArticles: ArticleCardItems = useMemo(
|
||||
() => tocItems.flatMap((item) => item.childTocItems || []),
|
||||
@@ -21,6 +22,7 @@ export const BespokeLanding = () => {
|
||||
<LandingHero title={title} intro={intro} heroImage={heroImage} introLinks={introLinks} />
|
||||
|
||||
<div className="container-xl px-3 px-md-6 mt-6 mb-4">
|
||||
<LandingCarousel recommended={recommended} />
|
||||
<ArticleGrid flatArticles={flatArticles} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ export type LandingContextT = {
|
||||
currentLearningTrack?: LearningTrack
|
||||
currentLayout: string
|
||||
heroImage?: string
|
||||
// For discovery landing pages
|
||||
// For landing pages with carousels
|
||||
recommended?: Array<{ title: string; intro: string; href: string; category: string[] }> // Resolved article data
|
||||
introLinks?: Record<string, string>
|
||||
// For journey landing pages
|
||||
@@ -51,7 +51,7 @@ export const getLandingContextFromRequest = async (
|
||||
|
||||
let recommended: Array<{ title: string; intro: string; href: string; category: string[] }> = []
|
||||
|
||||
if (landingType === 'discovery') {
|
||||
if (landingType === 'discovery' || landingType === 'bespoke') {
|
||||
// Use resolved recommended articles from the page after middleware processing
|
||||
if (page.recommended && Array.isArray(page.recommended) && page.recommended.length > 0) {
|
||||
recommended = page.recommended
|
||||
|
||||
Reference in New Issue
Block a user