stacker.news/pages/top/posts/[within].js

24 lines
694 B
JavaScript
Raw Normal View History

2021-12-16 23:05:31 +00:00
import Layout from '../../../components/layout'
import Items from '../../../components/items'
import { useRouter } from 'next/router'
import { getGetServerSideProps } from '../../../api/ssrApollo'
2022-02-17 17:23:43 +00:00
import { ITEMS } from '../../../fragments/items'
2021-12-16 23:05:31 +00:00
import TopHeader from '../../../components/top-header'
2022-02-17 17:23:43 +00:00
export const getServerSideProps = getGetServerSideProps(ITEMS, { sort: 'top' })
2021-12-16 23:05:31 +00:00
2022-02-17 17:23:43 +00:00
export default function Index ({ data: { items: { items, cursor } } }) {
2021-12-16 23:05:31 +00:00
const router = useRouter()
return (
<Layout>
<TopHeader cat='posts' />
<Items
items={items} cursor={cursor}
variables={{ sort: 'top', within: router.query?.within }} rank
/>
</Layout>
)
}