fix: rewriting rules for my-pages
This commit is contained in:
@@ -37,57 +37,51 @@ function DynamicComponent({ component, props }: AccountPageContentProps) {
|
||||
}
|
||||
|
||||
export default function Content({ lang, content }: ContentProps) {
|
||||
return (
|
||||
<>
|
||||
{content.map((item) => {
|
||||
switch (item.__typename) {
|
||||
case ContentEntries.AccountPageContentDynamicContent:
|
||||
const link = item.dynamic_content.link.linkConnection.edges.length
|
||||
? {
|
||||
href:
|
||||
item.dynamic_content.link.linkConnection.edges[0].node
|
||||
.original_url ||
|
||||
`/${lang}${item.dynamic_content.link.linkConnection.edges[0].node.url}`,
|
||||
text: item.dynamic_content.link.link_text,
|
||||
}
|
||||
: null
|
||||
|
||||
const componentProps = {
|
||||
lang,
|
||||
title: item.dynamic_content.title,
|
||||
// TODO: rename preamble to subtitle in Contentstack?
|
||||
subtitle: item.dynamic_content.preamble,
|
||||
...(link && { link }),
|
||||
return content.map((item) => {
|
||||
switch (item.__typename) {
|
||||
case ContentEntries.AccountPageContentDynamicContent:
|
||||
const link = item.dynamic_content.link.linkConnection.edges.length
|
||||
? {
|
||||
href:
|
||||
item.dynamic_content.link.linkConnection.edges[0].node
|
||||
.original_url ||
|
||||
`/${lang}${item.dynamic_content.link.linkConnection.edges[0].node.url}`,
|
||||
text: item.dynamic_content.link.link_text,
|
||||
}
|
||||
return (
|
||||
<DynamicComponent
|
||||
component={item.dynamic_content.component}
|
||||
props={componentProps}
|
||||
/>
|
||||
)
|
||||
case ContentEntries.AccountPageContentShortcuts:
|
||||
return (
|
||||
<Shortcuts
|
||||
shortcuts={item.shortcuts.shortcuts}
|
||||
subtitle={item.shortcuts.preamble}
|
||||
title={item.shortcuts.title}
|
||||
/>
|
||||
)
|
||||
case ContentEntries.AccountPageContentTextContent:
|
||||
return (
|
||||
<section>
|
||||
<JsonToHtml
|
||||
embeds={
|
||||
item.text_content.content.embedded_itemsConnection.edges
|
||||
}
|
||||
nodes={item.text_content.content.json.children}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
: null
|
||||
|
||||
const componentProps = {
|
||||
lang,
|
||||
title: item.dynamic_content.title,
|
||||
// TODO: rename preamble to subtitle in Contentstack?
|
||||
subtitle: item.dynamic_content.preamble,
|
||||
...(link && { link }),
|
||||
}
|
||||
})}
|
||||
</>
|
||||
)
|
||||
return (
|
||||
<DynamicComponent
|
||||
component={item.dynamic_content.component}
|
||||
props={componentProps}
|
||||
/>
|
||||
)
|
||||
case ContentEntries.AccountPageContentShortcuts:
|
||||
return (
|
||||
<Shortcuts
|
||||
shortcuts={item.shortcuts.shortcuts}
|
||||
subtitle={item.shortcuts.preamble}
|
||||
title={item.shortcuts.title}
|
||||
/>
|
||||
)
|
||||
case ContentEntries.AccountPageContentTextContent:
|
||||
return (
|
||||
<section>
|
||||
<JsonToHtml
|
||||
embeds={item.text_content.content.embedded_itemsConnection.edges}
|
||||
nodes={item.text_content.content.json.children}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user