Gwk-Cultural-Park/components/PreviewGalleryPage.tsx
2024-09-07 08:40:25 +07:00

32 lines
681 B
TypeScript

import GalleryPage, { GalleryPageProps } from 'components/GalleryPage'
import { usePreview } from 'lib/sanity.preview'
import { type Gallery, postAndMoreGallleriesQuery } from 'lib/sanity.queries'
export default function PreviewGalleryPage({
token,
post,
settings,
}: {
token: null | string
} & GalleryPageProps) {
const {
post: postPreview,
morePosts,
}: { post: Gallery; morePosts: Gallery[] } = usePreview(
token,
postAndMoreGallleriesQuery,
{
slug: post.slug,
}
) || { post: null, morePosts: [] }
return (
<GalleryPage
preview
post={postPreview}
morePosts={morePosts}
settings={settings}
/>
)
}