feat: AcfBuilder / SectionProse

This commit is contained in:
2026-03-27 09:27:15 -04:00
parent 0ebb530275
commit 12774b2df1
7 changed files with 50 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
fragment AcfBuilder on GroupAbstractBuilder_Fields {
sections @nullToEmpty @filterNullItems {
__typename
... on GroupAbstractBuilderSectionsProseLayout {
...SectionProse
}
}
}

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
import type { AcfBuilderFragment } from "#graphql/types";
const props = defineProps<{ builder: AcfBuilderFragment }>();
const sections = computed(() =>
props.builder.sections.map(({ __typename, ...section }) => ({
component: __typename.replace(/^GroupAbstractBuilderSections(.+?)Layout$/, "Section$1"),
section,
})),
);
</script>
<template>
<Component
v-for="({ component, section }, key) in sections"
:key="key"
:is="component"
:section="section"
/>
</template>

View File

@@ -1,3 +1,8 @@
fragment NodePage on Page {
title @nonNull
groupPostPage @nonNull {
builder @nonNull {
...AcfBuilder
}
}
}

View File

@@ -5,5 +5,7 @@ defineProps<{ node: NodePageFragment }>();
</script>
<template>
<div id="node-page">{{ node.title }}</div>
<div id="node-page">
<AcfBuilder :builder="node.groupPostPage.builder" />
</div>
</template>

View File

@@ -0,0 +1,3 @@
fragment SectionProse on GroupAbstractBuilderSectionsProseLayout {
content
}

View File

@@ -0,0 +1,9 @@
<script setup lang="ts">
import type { SectionProseFragment } from "#graphql/types";
defineProps<{ section: SectionProseFragment }>();
</script>
<template>
<div class="prose" v-html="section.content"></div>
</template>