Skip to content

Commit

Permalink
feat: add integration on image infographies
Browse files Browse the repository at this point in the history
  • Loading branch information
desoindx committed Feb 19, 2025
1 parent 5211504 commit 66513e2
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { computedEquivalents } from 'src/providers/equivalents'
import ImageInfography from 'components/outils/equivalents/infographies/ImageInfography'
import { imageInfographies } from 'components/outils/equivalents/infographies/list'

type Props = {
params: Promise<{ index: number; equivalent: string }>
}

const page = async (props: Props) => {
const params = await props.params

const equivalent = computedEquivalents.find((equivalent) => equivalent.slug === params.equivalent)
const infographie = imageInfographies[params.equivalent][params.index]

return equivalent && infographie ? (
<ImageInfography equivalent={equivalent} image={infographie.image} alt={infographie.alt} index={params.index} />
) : null
}

export default page
22 changes: 18 additions & 4 deletions app/(iframes)/iframes/infographie/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import React from 'react'
import IframeInfography from 'components/outils/equivalents/infographies/IframeInfography'
import { computedEquivalents } from 'src/providers/equivalents'
import Infography from 'components/outils/equivalents/infographies/Infography'

const page = () => {
return <IframeInfography />
type Props = {
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
}

const page = async (props: Props) => {
const searchParams = await props.searchParams
const equivalents = ((searchParams['equivalents'] as string) || '').split(',')
if (equivalents.length === 0) {
return null
}
const equivalent = computedEquivalents.find((equivalent) => equivalent.slug === equivalents[0])
if (!equivalent) {
return null
}

return <Infography equivalent={equivalent} equivalents={equivalents} />
}

export default page

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const ImageInfography = ({
tracking={`${getName('fr', equivalent)} image infographie ${index}`}
overScreens={overScreens}
secondary=''
smallPadding
withoutIntegration>
smallPadding>
<img src={`/images/${image}`} alt={alt} className={styles.image} />
</Shareable>
)
Expand Down
10 changes: 10 additions & 0 deletions src/components/shareable/overScreens/Values.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ export const overScreenEquivalentImageInfographyValues: (
/>
),
},

integrer: {
title: 'integrate',
children: (
<Integrate
path={`/image-infographie/${equivalent.slug}/${index}`}
tracking={`${getName('fr', equivalent)} image infographie ${index}`}
/>
),
},
})

export const overScreenEquivalentValues: (equivalent: ComputedEquivalent) => Record<string, OverScreenInfo> = (
Expand Down

0 comments on commit 66513e2

Please sign in to comment.