-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reflectionPreview template, rendering improvements
Resolves #2449
- Loading branch information
Showing
8 changed files
with
108 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/lib/output/themes/default/partials/reflectionPreview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { DeclarationReflection, ReflectionKind, type Reflection, ReflectionType } from "../../../../models"; | ||
import { JSX } from "../../../../utils"; | ||
import { getKindClass } from "../../lib"; | ||
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext"; | ||
|
||
export function reflectionPreview(context: DefaultThemeRenderContext, props: Reflection) { | ||
if (!(props instanceof DeclarationReflection)) return; | ||
|
||
// Each property of the interface will have a member rendered later on the page describing it, so generate | ||
// a type-like object with links to each member. | ||
if (props.kindOf(ReflectionKind.Interface)) { | ||
return ( | ||
<div class="tsd-signature"> | ||
<span class="tsd-signature-keyword">interface </span> | ||
<span class={getKindClass(props)}>{props.name} </span> | ||
{context.type(new ReflectionType(props), { topLevelLinks: true })} | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters