Skip to content

Commit

Permalink
add components to Project_Collection as page builder
Browse files Browse the repository at this point in the history
  • Loading branch information
milewskibogumil committed Nov 11, 2024
1 parent 90d3692 commit 3c97711
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/astro/src/pages/realizacje/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Hero, { Hero_Query, type HeroProps } from '@/components/Projects/Project/
import Gallery, { Gallery_Query, type Props as GalleryProps } from '@/components/Projects/Project/Gallery.astro'
import Summary, { Summary_Query, type Props as SummaryProps } from '@/components/Projects/Project/Summary.astro'
import Overview, { Overview_Query, type Props as OverviewProps } from '@/components/Projects/Project/Overview.astro'
import Components, { Components_Query, type ComponentsProps } from '@/components/Components.astro'
export const slugPrefix = '/realizacje/'
Expand All @@ -29,6 +30,7 @@ const page = await sanityFetch<{
summary: SummaryProps
overview: OverviewProps
gallery: GalleryProps
components: ComponentsProps
}>({
query: `
*[_type == 'Project_Collection' && slug.current == $slug][0] {
Expand All @@ -37,6 +39,7 @@ const page = await sanityFetch<{
${Summary_Query}
${Overview_Query}
${Gallery_Query}
${Components_Query}
}
`,
params: { slug: `${slugPrefix}${slug}` },
Expand All @@ -57,4 +60,5 @@ const metadata = await metadataFetch('Project_Collection', `${slugPrefix}${slug}
<Summary {...page.summary} />
<Overview {...page.overview} />
<Gallery {...page.gallery} />
<Components data={page.components} hasPreviousSections={true} />
</Layout>
5 changes: 5 additions & 0 deletions apps/sanity/schema/collectionTypes/Project_Collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ export default defineType({
collapsed: false,
}
}),
defineField({
name: 'components',
type: 'components',
title: 'Page Components',
}),
defineField({
name: 'seo',
type: 'seo',
Expand Down

0 comments on commit 3c97711

Please sign in to comment.