-
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.
- Loading branch information
1 parent
c2ed989
commit 5ba8196
Showing
7 changed files
with
170 additions
and
9 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,80 @@ | ||
--- | ||
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 PortableText, { PortableTextQuery, type PortableTextValue } from '@/components/ui/portable-text' | ||
const metadata = await metadataFetch('PrivacyPolicy_Page') | ||
const data = await sanityFetch<{ | ||
name: string | ||
slug: string | ||
header: { | ||
heading: PortableTextValue | ||
paragraph: PortableTextValue | ||
} | ||
content: PortableTextValue | ||
}>({ | ||
query: ` | ||
*[_type == "PrivacyPolicy_Page"][0] { | ||
"name": title, | ||
"slug": slug.current, | ||
header { | ||
${PortableTextQuery('heading')} | ||
${PortableTextQuery('paragraph')} | ||
}, | ||
${PortableTextQuery('content')} | ||
} | ||
`, | ||
}) | ||
--- | ||
|
||
<Layout {...metadata}> | ||
<Breadcrumbs data={[{ name: data.name, path: data.slug }]} /> | ||
<section class="header"> | ||
<PortableText value={data.header.heading} heading="h1" class="heading h2" /> | ||
<PortableText value={data.header.paragraph} /> | ||
</section> | ||
<section class="content"> | ||
<PortableText value={data.content} /> | ||
</section> | ||
</Layout> | ||
|
||
<style lang="scss"> | ||
.header, | ||
.content { | ||
max-width: 41rem; | ||
margin: 0 auto; | ||
} | ||
.header { | ||
margin-top: clamp(2rem, calc(3vw / 0.48), 5rem); | ||
.heading { | ||
margin-bottom: clamp(0.75rem, calc(1vw / 0.48), 1rem); | ||
} | ||
} | ||
.content { | ||
padding: clamp(3rem, calc(5vw / 0.48), 6rem) 0; | ||
counter-reset: counter; | ||
:global(h2) { | ||
&:not(:first-child) { | ||
margin-top: clamp(3rem, calc(4vw / 0.48), 5rem); | ||
} | ||
font-size: clamp(1.25rem, calc(1.5vw / 0.48), 1.5rem); | ||
margin-bottom: clamp(1rem, calc(1.75vw / 0.48), 1.75rem) !important; | ||
counter-increment: counter; | ||
display: grid; | ||
grid-template-columns: 1.5rem 1fr; | ||
gap: 0.5rem; | ||
&::before { | ||
content: counter(counter); | ||
} | ||
} | ||
@media (min-width: 31.25rem) { | ||
padding-left: 2rem; | ||
:global(h2) { | ||
margin-left: -2rem; | ||
} | ||
} | ||
} | ||
</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,61 @@ | ||
import { defineField, defineType } from "sanity" | ||
import { defineSlugForDocument } from "../../utils/define-slug-for-document"; | ||
import { PortableText } from "../ui/portable-text"; | ||
|
||
const name = 'PrivacyPolicy_Page'; | ||
const title = 'Polityka Prywatności'; | ||
const slug = '/polityka-prywatnosci'; | ||
const icon = () => '📄'; | ||
|
||
export default defineType({ | ||
name: name, | ||
type: 'document', | ||
title: title, | ||
icon, | ||
fields: [ | ||
...defineSlugForDocument({ slug: slug }), | ||
defineField({ | ||
name: 'header', | ||
type: 'object', | ||
title: 'Sekcja nagłówkowa', | ||
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() | ||
}), | ||
PortableText({ | ||
name: 'content', | ||
title: 'Treść', | ||
allowHeadings: true | ||
}), | ||
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
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