stacker.news/components/related.js

24 lines
678 B
JavaScript
Raw Normal View History

2022-10-26 22:46:01 +00:00
import { RELATED_ITEMS } from '../fragments/items'
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
export default function Related ({ title, itemId }) {
const variables = { title, id: itemId, limit: LIMIT }
2022-10-26 22:46:01 +00:00
return (
<AccordianItem
2023-07-24 18:35:05 +00:00
header={<div className='fw-bold'>related</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' />}
/>
}
2022-10-26 22:46:01 +00:00
/>
)
}