-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Investments_Page schema and initialization
- Loading branch information
1 parent
734e087
commit 6c88ae1
Showing
7 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
--- | ||
|
||
<section class="Hero"></section> | ||
|
||
<style lang="scss"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
import Layout from '@/src/layouts/Layout.astro' | ||
import metadataFetch from '@/utils/metadata.fetch' | ||
import sanityFetch from '@/utils/sanity.fetch' | ||
import Breadcrumbs from '@/components/ui/Breadcrumbs.astro' | ||
import Hero from '@/components/Investments/Hero.astro' | ||
import Components, { Components_Query, type ComponentsProps } from '@/components/Components.astro' | ||
const metadata = await metadataFetch('Investments_Page') | ||
const data = await sanityFetch<{ name: string; slug: string; components: ComponentsProps }>({ | ||
query: ` | ||
*[_type == "Investments_Page"][0] { | ||
"name": title, | ||
"slug": slug.current, | ||
${Components_Query} | ||
} | ||
`, | ||
}) | ||
--- | ||
|
||
<Layout {...metadata}> | ||
<Breadcrumbs data={[{ name: data.name, path: data.slug }]} /> | ||
<Hero /> | ||
<Components data={data.components} hasPreviousSections={true} /> | ||
</Layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { defineField, defineType } from "sanity" | ||
import { defineSlugForDocument } from "../../utils/define-slug-for-document"; | ||
|
||
const name = 'Investments_Page'; | ||
const title = 'Inwestycje'; | ||
const slug = '/inwestycje'; | ||
const icon = () => '💰'; | ||
|
||
export default defineType({ | ||
name: name, | ||
type: 'document', | ||
title: title, | ||
icon, | ||
fields: [ | ||
...defineSlugForDocument({ slug }), | ||
defineField({ | ||
name: 'hero', | ||
type: 'object', | ||
title: 'Sekcja Hero', | ||
description: 'Sekcja Hero, to sekcja, która znajduje się na górze strony.', | ||
fields: [ | ||
defineField({ | ||
name: 'heading', | ||
type: 'Heading', | ||
title: 'Nagłówek', | ||
validation: Rule => Rule.required(), | ||
}), | ||
defineField({ | ||
name: 'paragraph', | ||
type: 'PortableText', | ||
title: 'Paragraf', | ||
validation: Rule => Rule.required(), | ||
}), | ||
], | ||
validation: Rule => Rule.required(), | ||
}), | ||
defineField({ | ||
name: 'components', | ||
type: 'components', | ||
title: 'Page Components', | ||
}), | ||
defineField({ | ||
name: 'seo', | ||
type: 'seo', | ||
title: 'SEO', | ||
group: 'seo', | ||
}), | ||
], | ||
groups: [ | ||
{ | ||
name: 'seo', | ||
title: 'SEO', | ||
}, | ||
], | ||
preview: { | ||
prepare: () => ({ | ||
title: title, | ||
subtitle: slug | ||
}) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters