feat(SW-2134): Added support for images inside accordions

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-06-02 09:37:20 +00:00
parent d36754e24d
commit 09879d2f4a
2 changed files with 11 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
#import "../Image.graphql"
#import "../PageLink/AccountPageLink.graphql" #import "../PageLink/AccountPageLink.graphql"
#import "../PageLink/CollectionPageLink.graphql" #import "../PageLink/CollectionPageLink.graphql"
#import "../PageLink/ContentPageLink.graphql" #import "../PageLink/ContentPageLink.graphql"
@@ -31,6 +33,7 @@ fragment AccordionBlock on Accordion {
edges { edges {
node { node {
__typename __typename
...Image
...AccountPageLink ...AccountPageLink
...CollectionPageLink ...CollectionPageLink
...ContentPageLink ...ContentPageLink
@@ -57,6 +60,7 @@ fragment GlobalAccordionBlock on GlobalAccordion {
edges { edges {
node { node {
__typename __typename
...Image
...AccountPageLink ...AccountPageLink
...CollectionPageLink ...CollectionPageLink
...ContentPageLink ...ContentPageLink
@@ -109,6 +113,7 @@ fragment SpecificAccordion_ContentPage on ContentPageBlocksAccordionBlockAccordi
edges { edges {
node { node {
__typename __typename
...Image
...AccountPageLink ...AccountPageLink
...CollectionPageLink ...CollectionPageLink
...ContentPageLink ...ContentPageLink
@@ -209,6 +214,7 @@ fragment SpecificAccordion_DestinationCityPage on DestinationCityPageBlocksAccor
edges { edges {
node { node {
__typename __typename
...Image
...AccountPageLink ...AccountPageLink
...CollectionPageLink ...CollectionPageLink
...ContentPageLink ...ContentPageLink
@@ -309,6 +315,7 @@ fragment SpecificAccordion_DestinationCountryPage on DestinationCountryPageBlock
edges { edges {
node { node {
__typename __typename
...Image
...AccountPageLink ...AccountPageLink
...CollectionPageLink ...CollectionPageLink
...ContentPageLink ...ContentPageLink

View File

@@ -5,9 +5,12 @@ import {
linkUnionSchema, linkUnionSchema,
transformPageLink, transformPageLink,
} from "../pageLinks" } from "../pageLinks"
import { imageSchema } from "./image"
import { BlocksEnums } from "@/types/enums/blocks" import { BlocksEnums } from "@/types/enums/blocks"
export const embeddedContentSchema = z.union([linkUnionSchema, imageSchema])
export const accordionItemsSchema = z.array( export const accordionItemsSchema = z.array(
z.object({ z.object({
question: z.string(), question: z.string(),
@@ -16,7 +19,7 @@ export const accordionItemsSchema = z.array(
embedded_itemsConnection: z.object({ embedded_itemsConnection: z.object({
edges: z.array( edges: z.array(
z.object({ z.object({
node: linkUnionSchema.transform((data) => { node: embeddedContentSchema.transform((data) => {
const link = transformPageLink(data) const link = transformPageLink(data)
if (link) { if (link) {
return link return link