Files
hassp.pyc/src/components/blog/BlogRecentCard.astro
2025-06-08 20:06:03 +09:00

45 lines
1.2 KiB
Plaintext

---
import type { CollectionEntry } from 'astro:content'
import LeftSection from './blocks/LeftSection.astro'
import RightSection from './blocks/RightSection.astro'
const { blogs } = Astro.props
interface Props {
blogs: CollectionEntry<'posts'>[]
}
const posts = blogs.slice(0, 5)
---
{
posts.map((b, index) => index % 2 === 0
? (
<LeftSection
title={b.data.title}
subTitle={b.data.description}
btnExists={true}
btnTitle="Подробнее"
btnURL=`/posts/${b.slug}`
img={b.data.banner}
imgAlt={b.data.title}
/>
)
: (
<RightSection
title={b.data.title}
subTitle={b.data.description}
btnExists={true}
btnTitle="Подробнее"
btnURL=`/posts/${b.slug}`
img={b.data.banner}
imgAlt={b.data.title}
single={!b.data.banner2}
imgOne={b.data.banner}
imgOneAlt={b.data.title}
imgTwo={b.data?.banner2}
imgTwoAlt={b.data.title}
/>
))
}