Skip to content

Commit f0d7491

Browse files
authored
Merge pull request #565 from shibomb/fix/show-param-type-return-reference
Fix: Show param type and return in reference page.
2 parents d6a9b2e + bfb57eb commit f0d7491

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/content/ui/en.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Syntax: Syntax
3636
Methods: Methods
3737
Fields: Fields
3838
Parameters: Parameters
39+
Returns: Returns
3940
Related References: Related References
4041
Related Examples: Related Examples
4142
Show Code: Show Code

src/layouts/ReferenceItemLayout.astro

+23-4
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ const seenParams: Record<string, true> = {};
141141
entry.data.params.map((param: ReferenceParam) => (
142142
<div class="grid grid-cols-6 gap-gutter-md text-body">
143143
<span class="col-span-1 text-body">{param.name}</span>
144-
<span
145-
class="col-span-5 [&_p]:m-0 [&_a]:underline"
146-
set:html={param.description}
147-
/>
144+
<div
145+
class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
146+
>
147+
{param.type && <span>{param.type}: </span>}
148+
<span set:html={param.description} />
149+
</div>
148150
</div>
149151
))}
150152
{entry.data.overloads &&
@@ -169,6 +171,23 @@ const seenParams: Record<string, true> = {};
169171
</>
170172
)
171173
}
174+
{
175+
(entry.data.return) && (
176+
<>
177+
<div class="mb-xl">
178+
<h2 class="mb-md text-h3">{t("Returns")}</h2>
179+
<div class="grid grid-cols-6 gap-gutter-md text-body">
180+
<div
181+
class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
182+
>
183+
{entry.data.return.type && <span>{entry.data.return.type}: </span>}
184+
<span set:html={entry.data.return.description} />
185+
</div>
186+
</div>
187+
</div>
188+
</>
189+
)
190+
}
172191
{
173192
entry.data.properties && (
174193
<div class="mb-xl">

0 commit comments

Comments
 (0)