Skip to content

Commit 5f5affa

Browse files
committed
Merge branch 'padms/2280'
2 parents 307955a + 5ee4cc4 commit 5f5affa

File tree

3 files changed

+55
-15
lines changed

3 files changed

+55
-15
lines changed

web/pageComponents/pageTemplates/Event.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { EventSchema } from '../../types/types'
1313
import { EventJsonLd } from 'next-seo'
1414
import Blocks from '../../pageComponents/shared/portableText/Blocks'
1515
import { twMerge } from 'tailwind-merge'
16-
import CallToActions from '@sections/CallToActions'
16+
import RelatedContent from 'pageComponents/shared/RelatedContent'
1717

1818
export default function Event({ data }: { data: EventSchema }): JSX.Element {
1919
const { title } = data
@@ -84,17 +84,15 @@ export default function Event({ data }: { data: EventSchema }): JSX.Element {
8484
{contactList && <ContactList data={contactList} className="my-12" />}
8585

8686
{relatedLinks?.links && relatedLinks.links.length > 0 && (
87-
<CallToActions
87+
<RelatedContent
88+
data={relatedLinks}
8889
className={twMerge(`
8990
px-layout-lg
9091
max-w-viewport
91-
my-3xl
92+
9293
mx-auto
9394
pb-page-content
9495
`)}
95-
callToActions={relatedLinks.links}
96-
overrideButtonStyle={true}
97-
splitList={false}
9896
/>
9997
)}
10098
</article>

web/pageComponents/pageTemplates/News.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { metaTitleSuffix } from '../../languages'
1414
import type { NewsSchema } from '../../types/types'
1515
import { toPlainText } from '@portabletext/react'
1616
import Blocks from '../shared/portableText/Blocks'
17-
import CallToActions from '@sections/CallToActions'
1817
import { twMerge } from 'tailwind-merge'
18+
import RelatedContent from 'pageComponents/shared/RelatedContent'
1919

2020
const NewsLayout = styled.div`
2121
--banner-paddingHorizontal: clamp(16px, calc(-69.1942px + 22.7184vw), 367px);
@@ -222,15 +222,14 @@ const NewsPage = ({ data: news }: ArticleProps) => {
222222
{iframe && <BasicIFrame data={iframe} />}
223223

224224
{relatedLinks?.links && relatedLinks.links.length > 0 && (
225-
<CallToActions
225+
<RelatedContent
226+
data={relatedLinks}
226227
className={twMerge(`
227-
px-layout-lg
228-
max-w-viewport
229-
my-3xl
230-
`)}
231-
callToActions={relatedLinks.links}
232-
overrideButtonStyle={true}
233-
splitList={false}
228+
px-layout-lg
229+
max-w-viewport
230+
my-3xl
231+
mx-auto
232+
`)}
234233
/>
235234
)}
236235

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Fragment, HTMLAttributes } from 'react'
2+
import { Heading, List } from '@components'
3+
import type { RelatedLinksData, LinkData } from '../../types/types'
4+
import { ResourceLink } from '@core/Link'
5+
import { getUrlFromAction } from '../../common/helpers'
6+
import { getLocaleFromName } from '../../lib/localization'
7+
8+
const { Item } = List
9+
10+
type RelatedContentProps = {
11+
data: RelatedLinksData
12+
} & HTMLAttributes<HTMLDivElement>
13+
14+
const RelatedContent = ({ data, ...rest }: RelatedContentProps) => {
15+
return (
16+
<aside {...rest}>
17+
<Heading className="pb-4 text-left" size="xl" level="h2">
18+
{data.title}
19+
</Heading>
20+
<List unstyled>
21+
{data.links.length > 0 &&
22+
data.links.map((item: LinkData) => {
23+
const url = getUrlFromAction(item)
24+
return (
25+
<Fragment key={item.id}>
26+
<Item>
27+
<ResourceLink
28+
href={url as string}
29+
{...(item.link?.lang && { locale: getLocaleFromName(item.link?.lang) })}
30+
type={item.type}
31+
>
32+
{`${item.label} ${item.extension ? `(${item.extension.toUpperCase()})` : ''}`}
33+
</ResourceLink>
34+
</Item>
35+
</Fragment>
36+
)
37+
})}
38+
</List>
39+
</aside>
40+
)
41+
}
42+
43+
export default RelatedContent

0 commit comments

Comments
 (0)