fix: add rendering logic for optional link and preamble
This commit is contained in:
@@ -19,14 +19,27 @@ function DynamicComponent({
|
||||
lang: Lang
|
||||
user: User
|
||||
}) {
|
||||
const componentProps = {
|
||||
title: content.title,
|
||||
preamble: content.preamble,
|
||||
link: content.link.linkConnection.edges.length
|
||||
? {
|
||||
href: content.link.linkConnection.edges[0].node.url,
|
||||
text: content.link.link_text,
|
||||
}
|
||||
: null,
|
||||
}
|
||||
switch (content.component) {
|
||||
case DynamicContentComponents.membership_overview:
|
||||
return <Overview user={user} />
|
||||
case DynamicContentComponents.benefits:
|
||||
return null
|
||||
case DynamicContentComponents.previous_stays:
|
||||
return null
|
||||
case DynamicContentComponents.upcoming_stays:
|
||||
return <UpcomingStays lang={lang} stays={user.stays} />
|
||||
return (
|
||||
<UpcomingStays lang={lang} stays={user.stays} {...componentProps} />
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user