File tree Expand file tree Collapse file tree 3 files changed +55
-15
lines changed Expand file tree Collapse file tree 3 files changed +55
-15
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import type { EventSchema } from '../../types/types'
13
13
import { EventJsonLd } from 'next-seo'
14
14
import Blocks from '../../pageComponents/shared/portableText/Blocks'
15
15
import { twMerge } from 'tailwind-merge'
16
- import CallToActions from '@sections/CallToActions '
16
+ import RelatedContent from 'pageComponents/shared/RelatedContent '
17
17
18
18
export default function Event ( { data } : { data : EventSchema } ) : JSX . Element {
19
19
const { title } = data
@@ -84,17 +84,15 @@ export default function Event({ data }: { data: EventSchema }): JSX.Element {
84
84
{ contactList && < ContactList data = { contactList } className = "my-12" /> }
85
85
86
86
{ relatedLinks ?. links && relatedLinks . links . length > 0 && (
87
- < CallToActions
87
+ < RelatedContent
88
+ data = { relatedLinks }
88
89
className = { twMerge ( `
89
90
px-layout-lg
90
91
max-w-viewport
91
- my-3xl
92
+
92
93
mx-auto
93
94
pb-page-content
94
95
` ) }
95
- callToActions = { relatedLinks . links }
96
- overrideButtonStyle = { true }
97
- splitList = { false }
98
96
/>
99
97
) }
100
98
</ article >
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ import { metaTitleSuffix } from '../../languages'
14
14
import type { NewsSchema } from '../../types/types'
15
15
import { toPlainText } from '@portabletext/react'
16
16
import Blocks from '../shared/portableText/Blocks'
17
- import CallToActions from '@sections/CallToActions'
18
17
import { twMerge } from 'tailwind-merge'
18
+ import RelatedContent from 'pageComponents/shared/RelatedContent'
19
19
20
20
const NewsLayout = styled . div `
21
21
--banner-paddingHorizontal: clamp(16px, calc(-69.1942px + 22.7184vw), 367px);
@@ -222,15 +222,14 @@ const NewsPage = ({ data: news }: ArticleProps) => {
222
222
{ iframe && < BasicIFrame data = { iframe } /> }
223
223
224
224
{ relatedLinks ?. links && relatedLinks . links . length > 0 && (
225
- < CallToActions
225
+ < RelatedContent
226
+ data = { relatedLinks }
226
227
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
+ ` ) }
234
233
/>
235
234
) }
236
235
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments