Skip to content

Commit

Permalink
Merge pull request #565 from shibomb/fix/show-param-type-return-refer…
Browse files Browse the repository at this point in the history
…ence

Fix: Show param type and return in reference page.
  • Loading branch information
davepagurek authored Sep 23, 2024
2 parents d6a9b2e + bfb57eb commit f0d7491
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/content/ui/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Syntax: Syntax
Methods: Methods
Fields: Fields
Parameters: Parameters
Returns: Returns
Related References: Related References
Related Examples: Related Examples
Show Code: Show Code
Expand Down
27 changes: 23 additions & 4 deletions src/layouts/ReferenceItemLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ const seenParams: Record<string, true> = {};
entry.data.params.map((param: ReferenceParam) => (
<div class="grid grid-cols-6 gap-gutter-md text-body">
<span class="col-span-1 text-body">{param.name}</span>
<span
class="col-span-5 [&_p]:m-0 [&_a]:underline"
set:html={param.description}
/>
<div
class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
>
{param.type && <span>{param.type}: </span>}
<span set:html={param.description} />
</div>
</div>
))}
{entry.data.overloads &&
Expand All @@ -169,6 +171,23 @@ const seenParams: Record<string, true> = {};
</>
)
}
{
(entry.data.return) && (
<>
<div class="mb-xl">
<h2 class="mb-md text-h3">{t("Returns")}</h2>
<div class="grid grid-cols-6 gap-gutter-md text-body">
<div
class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
>
{entry.data.return.type && <span>{entry.data.return.type}: </span>}
<span set:html={entry.data.return.description} />
</div>
</div>
</div>
</>
)
}
{
entry.data.properties && (
<div class="mb-xl">
Expand Down

0 comments on commit f0d7491

Please sign in to comment.