Skip to content

Commit

Permalink
Fix double render of Hierarchy header
Browse files Browse the repository at this point in the history
Closes #2053.
  • Loading branch information
Gerrit0 committed Sep 18, 2022
1 parent 42fba94 commit 5478293
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@

- TypeDoc will now prefer comments on variable declarations over signature comments, #2042.
- Fixed double rendering of "Type Parameters" header, #2054.
- Fixed double rendering of "Hierarchy" header, #2053.
- Removed unused `widgets.png` and `widgets@2x.png` files from generated assets folder.

## v0.23.14 (2022-09-03)
Expand Down
40 changes: 23 additions & 17 deletions src/lib/output/themes/default/partials/hierarchy.tsx
Expand Up @@ -2,20 +2,26 @@ import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
import { JSX } from "../../../../utils";
import type { DeclarationHierarchy } from "../../../../models";

export const hierarchy = (context: DefaultThemeRenderContext, props: DeclarationHierarchy | undefined) => (
<>
{!!props && (
<section class="tsd-panel tsd-hierarchy">
<h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
{props.types.map((item, i, l) => (
<li>
{props.isTarget ? <span class="target">{item.toString()}</span> : context.type(item)}
{i === l.length - 1 && !!props.next && context.hierarchy(props.next)}
</li>
))}
</ul>
</section>
)}
</>
);
export function hierarchy(context: DefaultThemeRenderContext, props: DeclarationHierarchy | undefined) {
if (!props) return;

return (
<section class="tsd-panel tsd-hierarchy">
<h4>Hierarchy</h4>
{hierarchyList(context, props)}
</section>
);
}

function hierarchyList(context: DefaultThemeRenderContext, props: DeclarationHierarchy) {
return (
<ul class="tsd-hierarchy">
{props.types.map((item, i, l) => (
<li>
{props.isTarget ? <span class="target">{item.toString()}</span> : context.type(item)}
{i === l.length - 1 && !!props.next && hierarchyList(context, props.next)}
</li>
))}
</ul>
);
}

0 comments on commit 5478293

Please sign in to comment.