Skip to content

Commit

Permalink
Aktuelt vises ikke hvis innholdslisten er tom
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindskifjeld committed Feb 25, 2025
1 parent 4330158 commit 0f3ee32
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ export type PartConfigFrontpageCurrentTopics = {
export const FrontpageCurrentTopicsPart = ({
config,
}: PartComponentProps<PartType.FrontpageCurrentTopics>) => {
const { language } = usePageContentProps();
const { language, editorView } = usePageContentProps();
const { contentList, title, link, bgColor, itemColor } = config;

if (!contentList?.data.sectionContents) {
return <EditorHelp text={'Velg en innholdsliste'} />;
if (
!contentList ||
!contentList.data.sectionContents ||
contentList.data.sectionContents.length === 0
) {
if (!!editorView) {
return <EditorHelp text={'Velg en innholdsliste'} />;
} else {
return null;
}
}

return (
Expand Down

0 comments on commit 0f3ee32

Please sign in to comment.