stacker.news/components/related.js

25 lines
710 B
JavaScript
Raw Normal View History

import { RELATED_ITEMS } from '@/fragments/items'
2022-10-26 22:46:01 +00:00
import AccordianItem from './accordian-item'
import Items from './items'
import { NavigateFooter } from './more-footer'
2022-10-26 22:46:01 +00:00
const LIMIT = 5
2024-01-17 23:39:39 +00:00
export default function Related ({ title, itemId, ...props }) {
const variables = { title, id: itemId, limit: LIMIT }
2022-10-26 22:46:01 +00:00
return (
<AccordianItem
2024-01-15 23:22:32 +00:00
header={<div className='fw-bold'>related posts</div>}
2022-10-26 22:46:01 +00:00
body={
<Items
query={RELATED_ITEMS}
variables={variables}
destructureData={data => data.related}
Footer={props => <NavigateFooter {...props} href={`/items/${itemId}/related`} text='view all related items' />}
/>
}
2024-01-17 23:39:39 +00:00
{...props}
2022-10-26 22:46:01 +00:00
/>
)
}