-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 "alle tema" page now also has working chip data
- Loading branch information
1 parent
a23519a
commit f75530e
Showing
5 changed files
with
65 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
aksel.nav.no/website/components/layout/god-praksis-page/chips/dataTransforms.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { chipsDataAllQueryResponse } from "../queries"; | ||
import { ChipsData, ChipsDataGroupedByTema } from "../types"; | ||
|
||
export const groupByTema = ( | ||
chipsData: chipsDataAllQueryResponse["chipsDataAll"] | ||
): ChipsDataGroupedByTema => { | ||
const chipNavData: ChipsDataGroupedByTema = {}; | ||
for (const entry of chipsData) { | ||
for (const undertema of entry.undertema) { | ||
if (!chipNavData[undertema.temaSlug]) { | ||
chipNavData[undertema.temaSlug] = [ | ||
{ | ||
"undertema-title": undertema.title, | ||
"innholdstype-title": entry.innholdstype, | ||
}, | ||
]; | ||
continue; | ||
} | ||
chipNavData[undertema.temaSlug].push({ | ||
"undertema-title": undertema.title, | ||
"innholdstype-title": entry.innholdstype, | ||
}); | ||
} | ||
} | ||
return chipNavData; | ||
}; | ||
|
||
export const chipsDataForAllTema = ( | ||
chipsData: chipsDataAllQueryResponse["chipsDataAll"] | ||
): ChipsData => { | ||
const chipNavData: ChipsData = []; | ||
for (const entry of chipsData) { | ||
for (const undertema of entry.undertema) { | ||
chipNavData.push({ | ||
"undertema-title": undertema.title, | ||
"innholdstype-title": entry.innholdstype, | ||
}); | ||
} | ||
} | ||
return chipNavData; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters