stacker.news/components/items-mixed.js

35 lines
1.0 KiB
JavaScript
Raw Normal View History

2023-05-06 21:51:17 +00:00
import { Fragment } from 'react'
import { CommentFlat } from './comment'
2022-09-22 20:42:04 +00:00
import Item from './item'
import ItemJob from './item-job'
import { ItemsSkeleton } from './items'
import styles from './items.module.css'
import MoreFooter from './more-footer'
export default function MixedItems ({ rank, items, cursor, fetchMore }) {
return (
<>
<div className={styles.grid}>
{items.map((item, i) => (
2023-05-06 21:51:17 +00:00
<Fragment key={item.id}>
2022-09-22 20:42:04 +00:00
{item.parentId
? (
<><div />
2023-05-06 21:51:17 +00:00
<div className='pb-1 mb-1'>
<CommentFlat item={item} noReply includeParent clickToContext />
2022-09-22 20:42:04 +00:00
</div>
</>)
2022-09-29 20:42:33 +00:00
: (item.isJob
2022-09-22 20:42:04 +00:00
? <ItemJob item={item} rank={rank && i + 1} />
: <Item item={item} rank={rank && i + 1} />)}
2023-05-06 21:51:17 +00:00
</Fragment>
2022-09-22 20:42:04 +00:00
))}
</div>
<MoreFooter
cursor={cursor} fetchMore={fetchMore}
Skeleton={() => <ItemsSkeleton rank={rank} startRank={items.length} />}
/>
</>
)
}