Skip to content

Commit 9b56d8c

Browse files
authored
Merge pull request #1709 from navikt/overview-title-fix
Viser riktige titler på linkpanels i all_products oversiktssider
2 parents 3041102 + ffd4265 commit 9b56d8c

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/components/pages/overview-page/OverviewPage.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ export const OverviewPage = (props: OverviewPageProps) => {
7070
{filteredList.map((product) => (
7171
<li key={`${product.anchorId}-${language}`}>
7272
{isAllProductsOverview ? (
73-
<OverviewLinkPanel
74-
product={product.productLinks[0]}
75-
illustration={product.illustration}
76-
/>
73+
<OverviewLinkPanel product={product} />
7774
) : (
7875
<OverviewProductDetailsPanel
7976
productDetails={product}

src/components/pages/overview-page/product-elements/OverviewLinkPanel.tsx

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
import { MiniCard } from 'components/_common/card/MiniCard';
22
import { CardType } from 'types/card';
33
import { LinkProps } from 'types/link-props';
4-
import { AnimatedIconsProps } from 'types/content-props/animated-icons';
5-
import { OverviewPageProductLink } from 'types/content-props/overview-props';
4+
import { OverviewPageProductItem } from 'types/content-props/overview-props';
5+
import { logger } from 'srcCommon/logger';
66

77
import style from './ProductLink.module.scss';
88

99
type Props = {
10-
product: OverviewPageProductLink;
11-
illustration: AnimatedIconsProps;
10+
product: OverviewPageProductItem;
1211
};
1312

14-
export const OverviewLinkPanel = ({ product, illustration }: Props) => {
13+
export const OverviewLinkPanel = ({ product }: Props) => {
14+
const { title, illustration, productLinks } = product;
15+
16+
const productLink = productLinks[0];
17+
18+
if (!productLink?.url) {
19+
logger.error(`No url set for overview link panel ${title}`);
20+
return null;
21+
}
22+
1523
const link: LinkProps = {
16-
url: product.url,
17-
text: product.title,
24+
url: productLink.url,
25+
text: title,
1826
};
1927

2028
return (

0 commit comments

Comments
 (0)