Skip to content

Commit 9d943d9

Browse files
authored
Merge pull request #2034 from navikt/publishing-calendar-entry-link
Lenker i publiseringskalender
2 parents 94ea600 + ac223f9 commit 9d943d9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/components/parts/_legacy/publishing-calendar/PublishingCalendarEntryLegacyPart.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import { Table, BodyLong } from '@navikt/ds-react';
33
import { PublishingCalendarEntryProps } from 'types/content-props/publishing-calendar-props';
44
import { ContentProps, ContentType } from 'types/content-props/_content-common';
5+
import { LenkeInline } from 'components/_common/lenke/LenkeInline';
56

67
// eslint-disable-next-line css-modules/no-unused-class
78
import style from './PublishingCalendar.module.scss';
@@ -12,6 +13,7 @@ interface PublishingCalendarEntryData {
1213
publDate: Date;
1314
day: string;
1415
month: string;
16+
link?: string;
1517
}
1618

1719
const monthShortName = [
@@ -47,6 +49,7 @@ const processEntry = (item: PublishingCalendarEntryProps): PublishingCalendarEnt
4749
publDate,
4850
day: publDate.getDate().toString() + '.',
4951
month: monthShortName[publDate.getMonth()],
52+
link: item.data.link?._path,
5053
};
5154
};
5255

@@ -56,6 +59,7 @@ export const PublishingCalendarEntryLegacyPart = (props: ContentProps) => {
5659
}
5760

5861
const entry = processEntry(props);
62+
5963
return (
6064
<Table.Row>
6165
<Table.DataCell>
@@ -66,7 +70,11 @@ export const PublishingCalendarEntryLegacyPart = (props: ContentProps) => {
6670
</Table.DataCell>
6771
<Table.DataCell>
6872
<BodyLong className={style.dateInfo}>{entry.period}</BodyLong>
69-
<BodyLong>{entry.displayName}</BodyLong>
73+
{entry.link ? (
74+
<LenkeInline href={entry.link}>{entry.displayName}</LenkeInline>
75+
) : (
76+
<BodyLong>{entry.displayName}</BodyLong>
77+
)}
7078
</Table.DataCell>
7179
</Table.Row>
7280
);

src/types/content-props/publishing-calendar-props.ts

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export type PublishingCalendarEntryProps = ContentCommonProps & {
66
data: {
77
date: string;
88
period: string;
9+
link?: {
10+
_path: string;
11+
};
912
};
1013
};
1114

0 commit comments

Comments
 (0)