Skip to content

Commit 20fab0e

Browse files
authored
Merge pull request #1725 from navikt/rydde-forside-referanser
Fjerner ubrukte navigasjonsreferanser fra forsiden
2 parents 4738e4f + c6daec7 commit 20fab0e

File tree

2 files changed

+4
-58
lines changed

2 files changed

+4
-58
lines changed

src/components/layouts/index-page/front-page/FrontPageAreaNavigation.tsx

+4-55
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@ type Props = {
1616

1717
export const FrontPageAreaNavigation = ({ content }: Props) => {
1818
const { data } = content;
19-
const {
20-
areasHeader,
21-
areasRefs = [],
22-
situationsRefs = [],
23-
frontPageNestedRefs = [],
24-
navigationRefs = [],
25-
audience,
26-
} = data;
19+
const { areasHeader, navigationRefs = [], audience } = data;
2720

2821
const getCardType = (audience: Audience) => {
2922
if (audience === Audience.EMPLOYER) {
@@ -52,12 +45,6 @@ export const FrontPageAreaNavigation = ({ content }: Props) => {
5245

5346
const cardType = getCardType(getAudience(audience));
5447

55-
const numberOfCards =
56-
areasRefs.length +
57-
frontPageNestedRefs.length +
58-
situationsRefs.length +
59-
navigationRefs.length;
60-
6148
return (
6249
<div
6350
className={classNames(style.wrapper, style[getAudience(audience)])}
@@ -74,49 +61,11 @@ export const FrontPageAreaNavigation = ({ content }: Props) => {
7461
<ul
7562
className={classNames(
7663
style.cards,
77-
numberOfCards === 2 ? style.twocols : style.threecols
64+
navigationRefs.length === 2
65+
? style.twocols
66+
: style.threecols
7867
)}
7968
>
80-
{areasRefs.map((areaContent) => (
81-
<li key={areaContent._id}>
82-
<AreaCard
83-
path={areaContent._path}
84-
title={areaContent.data.header}
85-
area={areaContent.data.area}
86-
linkGroup={areasHeader}
87-
/>
88-
</li>
89-
))}
90-
{frontPageNestedRefs.map((content) => (
91-
<li key={content._id}>
92-
<FrontPageCard
93-
illustration={content.data?.illustration}
94-
path={content._path}
95-
title={
96-
content.data?.title || content.displayName
97-
}
98-
type={cardType}
99-
/>
100-
</li>
101-
))}
102-
{situationsRefs.map((situationPage) => {
103-
return (
104-
<li key={situationPage._id}>
105-
<FrontPageCard
106-
illustration={
107-
situationPage.data?.illustration
108-
}
109-
path={situationPage._path}
110-
title={
111-
situationPage.data?.title ||
112-
situationPage.displayName
113-
}
114-
type={cardType}
115-
/>
116-
</li>
117-
);
118-
})}
119-
12069
{navigationRefs.map((page) => {
12170
if (page.type === ContentType.AreaPage) {
12271
return (

src/types/content-props/index-pages-props.ts

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export type NavigationRefs =
2424
| OtherRefsProps;
2525

2626
export type FrontPageData = {
27-
areasRefs: AreaPageProps[];
28-
frontPageNestedRefs: FrontPageNestedProps[];
29-
situationsRefs: SituationPageProps[];
3027
navigationRefs: NavigationRefs[];
3128
areasHeader: string;
3229
} & CommonData;

0 commit comments

Comments
 (0)