Skip to content

Commit

Permalink
Merge pull request #2664 from nick-ls/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 authored Aug 13, 2024
2 parents f0de38c + dfb19e6 commit 3e13dc1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/lib/output/themes/default/DefaultTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,11 @@ export class DefaultTheme extends Theme {
}

if (parent.categories && shouldShowCategories(parent, opts)) {
return filterMap(parent.categories, toNavigation);
return filterMapWithNoneCollection(parent.categories);
}

if (parent.groups && shouldShowGroups(parent, opts)) {
return filterMap(parent.groups, toNavigation);
return filterMapWithNoneCollection(parent.groups);
}

if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
Expand All @@ -397,6 +397,20 @@ export class DefaultTheme extends Theme {
return filterMap(parent.childrenIncludingDocuments, toNavigation);
}

function filterMapWithNoneCollection(reflection: ReflectionGroup[] | ReflectionCategory[]) {
const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");

const mappedOthers = filterMap(others, toNavigation);

if (none) {
const noneMappedChildren = filterMap(none.children, toNavigation);
return [...noneMappedChildren, ...mappedOthers];
}

return mappedOthers;
}

function deriveModuleFolders(children: Array<DeclarationReflection | DocumentReflection>) {
const result: NavigationElement[] = [];

Expand Down

0 comments on commit 3e13dc1

Please sign in to comment.