File size: 1,666 Bytes
1b72d7e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import BlogPostCard from './BlogPostCard'
// import Collapse from '@/components/Collapse'
/**
* 导航列表
* @param posts 所有文ç«
* @param tags æ‰€æœ‰æ ‡ç¾
* @returns {JSX.Element}
* @constructor
*/
const BlogPostItem = (props) => {
const { group } = props
if (group?.category) {
return <>
<div id={group?.category} className='category text-lg font-normal pt-9 pb-4 first:pt-4 select-none flex justify-between font-sans text-neutral-800 dark:text-neutral-400 p-2' key={group?.category}>
<h3><i className={`text-base mr-2 ${group?.icon ? group?.icon : 'fas fa-hashtag'}`} />{group?.category}</h3>
</div>
<div id='posts-wrapper' className='card-list grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5' >
{group?.items?.map(post => (
<BlogPostCard key={post.id} className='card' post={post} />
))}
</div>
</>
} else {
return <>
<div id='uncategory' className='category text-lg pt-9 pb-4 first:pt-4 font-bold select-none flex justify-between font-sans text-neutral-800 dark:text-neutral-400 p-2' key='uncategory'>
<span><i className={`text-base mr-2 ${group?.icon ? group?.icon : 'fas fa-hashtag'}`} />未分类</span>
</div>
<div className='card-list grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5'>
{group?.items?.map(post => (
<BlogPostCard key={post.id} className='card' post={post} />
))}
</div>
</>
}
}
export default BlogPostItem
|