190600
This commit is contained in:
44
src/components/blog/BlogRecentCard.astro
Normal file
44
src/components/blog/BlogRecentCard.astro
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
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}
|
||||
/>
|
||||
))
|
||||
}
|
||||
Reference in New Issue
Block a user