Gwk-Cultural-Park/components/PreviewGalleryPage.tsx

32 lines
681 B
TypeScript
Raw Normal View History

2024-09-07 01:40:25 +00:00
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}
/>
)
}