Skip to content

Commit 8ee559b

Browse files
authored
Merge pull request #47 from navikt/empty-nodes
Do not set content if node is empty
2 parents 64b96fc + e996cca commit 8ee559b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: xp-archive/client/contentTree/contentTreeEntry/NavigationItem.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@ export const NavigationItem = ({ entry }: Props) => {
2222

2323
const entryLocalized = entry.isLocalized || entry.hasLocalizedDescendants;
2424

25+
const onClick = () => {
26+
if (!entry.isEmpty) {
27+
setSelectedContentId(entry.id);
28+
}
29+
};
30+
2531
return (
2632
<TreeItem
2733
className={entryLocalized ? '' : style.foggy}
2834
itemId={entry.id}
2935
label={label}
30-
onClick={() => {
31-
setSelectedContentId(entry.id);
32-
}}
36+
onClick={onClick}
3337
>
3438
{entry.numChildren > 0 ? (
3539
<NavigationItems path={entry.path} locale={entry.locale} />

0 commit comments

Comments
 (0)