Skip to content

Commit

Permalink
fix(pdc-frontend): fix the build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 committed Oct 12, 2023
1 parent 9c9c415 commit 5c103cb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions apps/pdc-frontend/src/app/[locale]/products/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const Product = async ({ params: { locale, slug }, searchParams }: ProductProps)
const Sections = () =>
product?.attributes && product?.attributes.sections.length > 0
? product?.attributes.sections.map((component: any, index: number) => {
switch (component.__typename) {
switch (component?.__typename) {
case 'ComponentComponentsBlockContent':
return component.content ? (
<Markdown imageUrl={getImageBaseUrl()} priceData={priceData} locale={locale} key={index}>
Expand Down Expand Up @@ -158,25 +158,29 @@ const Product = async ({ params: { locale, slug }, searchParams }: ProductProps)
</SpotlightSection>
) : null;
case 'ComponentComponentsButtonLink':
return component.text && component.href ? (
return component?.text && component?.href ? (
<div>
{component?.label && <Heading3>{component?.label}</Heading3>}
<ButtonLink
appearance={`${component?.button_link_appearance}-action-button`}
href={component.href}
external={isAbsoluteUrl(component.href)}
rel={isAbsoluteUrl(component.href) ? 'noopener noreferrer' : undefined}
external={isAbsoluteUrl(component?.href)}
rel={isAbsoluteUrl(component?.href) ? 'noopener noreferrer' : undefined}
>
{component.text} {component?.icon === 'arrow' && <UtrechtIconArrow />}
{component?.text} {component?.icon === 'arrow' && <UtrechtIconArrow />}
</ButtonLink>
</div>
) : null;
case 'ComponentComponentsMultiColumnsButton':
return <MultiColumnsButton columns={component.column} />;
case 'ComponentComponentsLink':
return component?.href && component?.text ? (
<AdvancedLink href={component.href} external={isAbsoluteUrl(component.href)} icon={component.iconList}>
{component.text}
<AdvancedLink
href={component?.href}
external={isAbsoluteUrl(component?.href)}
icon={component?.iconList}
>
{component?.text}
</AdvancedLink>
) : null;
default:
Expand Down

0 comments on commit 5c103cb

Please sign in to comment.