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