Skip to content

Commit b924b24

Browse files
Merge pull request #2187 from navikt/Aktuelt-skal-ikke-vises-hvis-innholdsliste-ikke-har-innhold
Aktuelt-seksjon på forsider/undersider skal ikke vises hvis innholdsliste ikke har innhold Testet av Janne og Eivind i dev2
2 parents d970740 + 831d23b commit b924b24

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/components/parts/frontpage-current-topics/FrontpageCurrentTopicsPart.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@ export type PartConfigFrontpageCurrentTopics = {
2323
export const FrontpageCurrentTopicsPart = ({
2424
config,
2525
}: PartComponentProps<PartType.FrontpageCurrentTopics>) => {
26-
const { language } = usePageContentProps();
26+
const { language, editorView } = usePageContentProps();
2727
const { contentList, title, link, bgColor, itemColor } = config;
2828

29-
if (!contentList?.data.sectionContents) {
30-
return <EditorHelp text={'Velg en innholdsliste'} />;
29+
if (
30+
!contentList ||
31+
!contentList.data.sectionContents ||
32+
contentList.data.sectionContents.length === 0
33+
) {
34+
if (!!editorView) {
35+
return <EditorHelp text={'Velg en innholdsliste'} />;
36+
} else {
37+
return null;
38+
}
3139
}
3240

3341
return (

0 commit comments

Comments
 (0)