diff --git a/apps/astro/src/components/Components.astro b/apps/astro/src/components/Components.astro index e57a221..269956d 100644 --- a/apps/astro/src/components/Components.astro +++ b/apps/astro/src/components/Components.astro @@ -3,11 +3,15 @@ import type { ComponentProps } from 'astro/types' import SimpleCtaSection, { SimpleCtaSection_Query } from '@/components/global/SimpleCtaSection.astro' import SplitContentImageGrid, { SplitContentImageGrid_Query } from '@/components/global/SplitContentImageGrid.astro' import SimpleHeadingFullImage, { SimpleHeadingFullImage_Query } from '@/components/global/SimpleHeadingFullImage.astro' +import FeatureAccordionSection, { + FeatureAccordionSection_Query, +} from '@/components/global/FeatureAccordionSection.astro' const components = { SimpleCtaSection, SplitContentImageGrid, SimpleHeadingFullImage, + FeatureAccordionSection, } type ComponentsMap = { @@ -31,6 +35,7 @@ export const Components_Query = /* groq */ ` _type == "SimpleCtaSection" => ${SimpleCtaSection_Query} _type == "SplitContentImageGrid" => ${SplitContentImageGrid_Query} _type == "SimpleHeadingFullImage" => ${SimpleHeadingFullImage_Query} + _type == "FeatureAccordionSection" => ${FeatureAccordionSection_Query} }, ` --- diff --git a/apps/astro/src/components/global/FeatureAccordionSection.astro b/apps/astro/src/components/global/FeatureAccordionSection.astro new file mode 100644 index 0000000..c728137 --- /dev/null +++ b/apps/astro/src/components/global/FeatureAccordionSection.astro @@ -0,0 +1,68 @@ +--- +import PortableText, { PortableTextQuery, type PortableTextValue } from '@/components/ui/portable-text' +import Image, { ImageDataQuery, type ImageDataProps } from '@/components/ui/image' +import Accordion from '@/components/ui/Accordion.astro' + +export const FeatureAccordionSection_Query = ` + { + ${ImageDataQuery('img')} + ${PortableTextQuery('heading')} + list[] { + ${PortableTextQuery('title')} + ${PortableTextQuery('description')} + } + }, +` +export type Props = { + index: number + img: ImageDataProps + heading: PortableTextValue + list: { + title: PortableTextValue + description: PortableTextValue + }[] +} + +const { index, img, heading, list } = Astro.props +--- + + + + + + { + list?.map(({ title, description }, i) => ( + + + + )) + } + + + + diff --git a/apps/astro/src/components/global/SimpleHeadingFullImage.astro b/apps/astro/src/components/global/SimpleHeadingFullImage.astro index 2121cc9..6a6ecc5 100644 --- a/apps/astro/src/components/global/SimpleHeadingFullImage.astro +++ b/apps/astro/src/components/global/SimpleHeadingFullImage.astro @@ -58,10 +58,10 @@ const { index, heading, paragraph, cta, image } = Astro.props @supports (animation-timeline: view()) { animation: scroll-image linear forwards; animation-timeline: view(); - transform-origin: bottom; + transform-origin: center; @keyframes scroll-image { from { - transform: translateY(-10%) scale(1.1); + transform: translateY(-8%) scale(1.16); } to { transform: translateY(0%) scale(1); diff --git a/apps/sanity/schema/Components.ts b/apps/sanity/schema/Components.ts index acfb7e0..110bf64 100644 --- a/apps/sanity/schema/Components.ts +++ b/apps/sanity/schema/Components.ts @@ -2,6 +2,7 @@ import { defineType } from "sanity"; import SimpleCtaSection from "./components/SimpleCtaSection"; import SplitContentImageGrid from "./components/SplitContentImageGrid"; import SimpleHeadingFullImage from "./components/SimpleHeadingFullImage"; +import FeatureAccordionSection from "./components/FeatureAccordionSection"; export default defineType({ name: 'components', @@ -10,7 +11,8 @@ export default defineType({ of: [ SimpleCtaSection, SplitContentImageGrid, - SimpleHeadingFullImage + SimpleHeadingFullImage, + FeatureAccordionSection, ], options: { insertMenu: { diff --git a/apps/sanity/schema/components/FeatureAccordionSection.ts b/apps/sanity/schema/components/FeatureAccordionSection.ts new file mode 100644 index 0000000..7194299 --- /dev/null +++ b/apps/sanity/schema/components/FeatureAccordionSection.ts @@ -0,0 +1,75 @@ +import { defineField } from 'sanity'; +import { toPlainText } from '../../utils/to-plain-text'; + +const name = 'FeatureAccordionSection'; +const title = 'Sekcja z akordeonem cech'; +const icon = () => '🏛️'; + +export default defineField({ + name, + type: 'object', + title, + icon, + fields: [ + defineField({ + name: 'img', + type: 'image', + title: 'Zdjęcie', + validation: Rule => Rule.required(), + }), + defineField({ + name: 'heading', + type: 'Heading', + title: 'Nagłówek', + validation: Rule => Rule.required(), + }), + defineField({ + name: 'list', + type: 'array', + title: 'Lista', + of: [ + defineField({ + name: 'item', + type: 'object', + fields: [ + defineField({ + name: 'title', + type: 'Heading', + title: 'Tytuł', + validation: Rule => Rule.required(), + }), + defineField({ + name: 'description', + type: 'PortableText', + title: 'Opis', + validation: Rule => Rule.required(), + }), + ], + preview: { + select: { + title: 'title', + description: 'description', + }, + prepare: ({ title, description }) => ({ + title: toPlainText(title), + subtitle: toPlainText(description), + }), + } + }), + ], + validation: Rule => Rule.required() + }), + ], + preview: { + select: { + heading: 'heading', + media: 'img', + }, + prepare: ({ heading, media }) => ({ + title: title, + subtitle: toPlainText(heading), + media, + icon, + }), + }, +}); diff --git a/apps/sanity/static/FeatureAccordionSection.webp b/apps/sanity/static/FeatureAccordionSection.webp new file mode 100644 index 0000000..5d0fe30 Binary files /dev/null and b/apps/sanity/static/FeatureAccordionSection.webp differ