import type { FrontMatterMeta } from '@rspress/core'; import { normalizeImagePath, useFrontmatter } from '@rspress/core/runtime'; import { Button, Link, renderHtmlOrText } from '@rspress/core/theme'; import './index.scss'; import clsx from 'clsx'; const DEFAULT_HERO = { badge: '', name: '', text: '', tagline: '', actions: [], image: undefined, } satisfies FrontMatterMeta['hero']; interface HomeHeroProps { beforeHeroActions?: React.ReactNode; afterHeroActions?: React.ReactNode; image?: React.ReactNode; } function HomeHero({ beforeHeroActions, afterHeroActions, image, }: HomeHeroProps) { const { frontmatter } = useFrontmatter(); const hero = frontmatter?.hero || DEFAULT_HERO; const hasImage = hero.image !== undefined || image !== undefined; const multiHeroText = hero.text ? hero.text .toString() .split(/\n/g) .filter(text => text !== '') : []; const imageSrc = typeof hero.image?.src === 'string' ? { light: hero.image.src, dark: hero.image.src } : hero.image?.src || { light: '', dark: '' }; return (