Skip to content

Commit

Permalink
fix: added flattenToAppUrl function to View Links
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrina-bongiovanni committed Nov 21, 2024
1 parent 6f07049 commit 0c28877
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ type Props = BlockViewProps & {
export default function View({ data, className, style }: Props) {
const Container = config.getComponent('Container').component || 'div';

function flattenToAppURL(arg0: any) {
throw new Error('Function not implemented.');
}

return (
<section
className={cx('block-calltoaction', styles.block, className)}
Expand All @@ -36,7 +40,11 @@ export default function View({ data, className, style }: Props) {
)}
{data.linkHref?.[0] && (
<CTA
href={data.linkHref ? data.linkHref[0]['@id'] : undefined}
href={
data.linkHref
? flattenToAppURL(data.linkHref[0]['@id'])
: undefined
}
openLinkInNewTab={false}
{...data}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ export default function View({ data, className, style }: Props) {
)}
{data.linkHref?.[0] && (
<CTA
href={data.linkHref ? data.linkHref[0]['@id'] : undefined}
href={
data.linkHref
? flattenToAppURL(data.linkHref[0]['@id'])
: undefined
}
openLinkInNewTab={false}
{...data}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export default function View({ data, className, style }: Props) {

const Container = config.getComponent('Container').component || 'div';

function flattenToAppURL(arg0: any) {
throw new Error('Function not implemented.');
}

return (
<>
<section
Expand Down Expand Up @@ -58,7 +62,11 @@ export default function View({ data, className, style }: Props) {
</div>
{data.linkHref?.[0] && (
<CTA
href={data.linkHref ? data.linkHref[0]['@id'] : undefined}
href={
data.linkHref
? flattenToAppURL(data.linkHref[0]['@id'])
: undefined
}
openLinkInNewTab={false}
{...data}
>
Expand Down
10 changes: 9 additions & 1 deletion packages/volto-blocks/src/components/blocks/PageIntro/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ type Props = BlockViewProps & {
export default function View({ data, className, style }: Props) {
const Container = config.getComponent('Container').component || 'div';

function flattenToAppURL(arg0: any) {
throw new Error('Function not implemented.');
}

return (
<section
className={cx('block-pageintro', styles.block, className)}
Expand All @@ -30,7 +34,11 @@ export default function View({ data, className, style }: Props) {
)}
{data.linkHref?.[0] && (
<CTA
href={data.linkHref ? data.linkHref[0]['@id'] : undefined}
href={
data.linkHref
? flattenToAppURL(data.linkHref[0]['@id'])
: undefined
}
openLinkInNewTab={false}
{...data}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ type Props = BlockViewProps & {

export default function View({ data, className, style }: Props) {
const Container = config.getComponent('Container').component || 'div';
function flattenToAppURL(arg0: any) {
throw new Error('Function not implemented.');
}

// const Image = config.getComponent('Image').component;

return (
Expand Down Expand Up @@ -49,7 +53,11 @@ export default function View({ data, className, style }: Props) {
)}
{data.linkHref?.[0] && (
<CTA
href={data.linkHref ? data.linkHref[0]['@id'] : undefined}
href={
data.linkHref
? flattenToAppURL(data.linkHref[0]['@id'])
: undefined
}
openLinkInNewTab={false}
{...data}
>
Expand Down

0 comments on commit 0c28877

Please sign in to comment.