Skip to content

Commit

Permalink
Partials: settings, primaryNavigation, secondaryNavigation
Browse files Browse the repository at this point in the history
Resolves #1987
  • Loading branch information
Gerrit0 committed Jul 8, 2022
1 parent d9de9f7 commit 59a33de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@

- Improved support for `--entryPointStrategy Packages`. TypeDoc will now load package-specific configurations from `package.json` `typedoc` field. This configuration allows configuring a custom display name (`typedoc.displayName`) field, entry point (`typedoc.entryPoint` - this is equivalent and will override `typedocMain`), and path to a readme file to be rendered at the top of the package page (`typedoc.readmeFile`), #1658.
- The `--includeVersion` option will now be respected by `--entryPointStrategy Packages`. Also, for this combination, missing `version` field in the root `package.json` will not issue a warning.
- The `navigation` partial will now call the new `settings`, `primaryNavigation`, and `secondaryNavigation` partials, #1987.

### Bug Fixes

Expand Down
10 changes: 9 additions & 1 deletion src/lib/output/themes/default/DefaultThemeRenderContext.ts
Expand Up @@ -21,7 +21,12 @@ import { memberSignatures } from "./partials/member.signatures";
import { memberSources } from "./partials/member.sources";
import { members } from "./partials/members";
import { membersGroup } from "./partials/members.group";
import { navigation } from "./partials/navigation";
import {
navigation,
primaryNavigation,
secondaryNavigation,
settings,
} from "./partials/navigation";
import { parameter } from "./partials/parameter";
import { toolbar } from "./partials/toolbar";
import { type } from "./partials/type";
Expand Down Expand Up @@ -83,6 +88,9 @@ export class DefaultThemeRenderContext {
members = bind(members, this);
membersGroup = bind(membersGroup, this);
navigation = bind(navigation, this);
settings = bind(settings, this);
primaryNavigation = bind(primaryNavigation, this);
secondaryNavigation = bind(secondaryNavigation, this);
parameter = bind(parameter, this);
toolbar = bind(toolbar, this);
type = bind(type, this);
Expand Down
14 changes: 7 additions & 7 deletions src/lib/output/themes/default/partials/navigation.tsx
@@ -1,15 +1,15 @@
import { ContainerReflection, DeclarationReflection, Reflection, ReflectionKind } from "../../../../models";
import { JSX, partition } from "../../../../utils";
import type { PageEvent } from "../../../events";
import { classNames, camelToTitleCase, wbr } from "../../lib";
import { camelToTitleCase, classNames, wbr } from "../../lib";
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";

export function navigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>) {
return (
<>
{settings(context)}
{primaryNavigation(context, props)}
{secondaryNavigation(context, props)}
{context.settings()}
{context.primaryNavigation(props)}
{context.secondaryNavigation(props)}
</>
);
}
Expand All @@ -26,7 +26,7 @@ function buildFilterItem(context: DefaultThemeRenderContext, name: string, displ
);
}

function settings(context: DefaultThemeRenderContext) {
export function settings(context: DefaultThemeRenderContext) {
const defaultFilters = context.options.getValue("visibilityFilters") as Record<string, boolean>;

const visibilityOptions: JSX.Element[] = [];
Expand Down Expand Up @@ -82,7 +82,7 @@ function settings(context: DefaultThemeRenderContext) {
);
}

function primaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>) {
export function primaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>) {
// Create the navigation for the current page

const modules = props.model.project.getChildrenByKind(ReflectionKind.SomeModule);
Expand Down Expand Up @@ -130,7 +130,7 @@ function primaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<
}
}

function secondaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>) {
export function secondaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>) {
// Multiple entry points, and on main project page.
if (props.model.isProject() && props.model.getChildrenByKind(ReflectionKind.Module).length) {
return;
Expand Down

0 comments on commit 59a33de

Please sign in to comment.