Skip to content

Commit

Permalink
Fix PrettyJson records rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Apr 2, 2024
1 parent 24287df commit 661c30a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/components/PrettyJson/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,29 @@ export const PrettyJson = ({ json }: { json: AnyObject }) => {
<Key>{key}</Key>
<Bracket char="[" />
</div>
<div>{value.map((v) => render(v, key))}</div>
<div>
{value.map((v, index) => {
if (typeof v === "object") {
return (
<div
key={`${keyProp}-${index}`}
className="PrettyJson__nested"
>
<div className="PrettyJson__inline">
<Bracket char="{" />
</div>
<div>{render(v)}</div>
<div>
<Bracket char="}" />
<Comma />
</div>
</div>
);
}

return render(v, key);
})}
</div>
<div>
<Bracket char="]" />
<Comma />
Expand Down

0 comments on commit 661c30a

Please sign in to comment.