Skip to content

Commit 6e268bb

Browse files
KianNHsdnts
authored andcommitted
[Docs Site] Amend SchemaRow styling (cloudflare#22630)
* [Docs Site] Amend SchemaRow styling * lint
1 parent 7202853 commit 6e268bb

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

src/components/models/SchemaRow.astro

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,22 @@
22
import { Type, MetaInfo } from "~/components";
33
import { type SchemaNode } from "@stoplight/json-schema-tree";
44
5-
const { node, root } = Astro.props;
5+
const { node } = Astro.props;
66
---
77

8-
<li
9-
class={`py-2 my-0! list-none! ${root ? "" : "border-l border-l-gray-200 dark:border-l-gray-500 pl-4"}`}
10-
>
11-
{
12-
(
13-
<code
14-
class="mr-2 rounded-md bg-gray-100 pr-0! font-mono"
15-
title={node.title}
16-
>
17-
{node.subpath[node.subpath.length - 1]}
18-
{node.parent.fragment?.required?.includes(
19-
node.subpath[node.subpath.length - 1],
20-
) ? (
21-
<span class="font-semibold text-red-500">*</span>
22-
) : (
23-
""
24-
)}
25-
</code>
26-
)
27-
}
8+
<li>
9+
<code title={node.title}>{node.subpath[node.subpath.length - 1]}</code>
2810

2911
{node.primaryType && <Type text={node.primaryType} />}
12+
3013
{node.combiners && node.combiners.includes("oneOf") && <Type text="one of" />}
3114

15+
{
16+
node.parent.fragment?.required?.includes(
17+
node.subpath[node.subpath.length - 1],
18+
) && <MetaInfo text="required" />
19+
}
20+
3221
{
3322
node.annotations.default && (
3423
<MetaInfo text={`default ${node.annotations.default}`} />
@@ -50,11 +39,11 @@ const { node, root } = Astro.props;
5039
/>
5140
)
5241
}
53-
<p class="mb-0!">{node.annotations.description}</p>
42+
<p>{node.annotations.description}</p>
5443

5544
{
5645
node.children && (
57-
<ul class="m-0 ml-4 list-none! p-0">
46+
<ul class="pl-6">
5847
{node.children.map((node: SchemaNode) => (
5948
<Astro.self node={node} />
6049
))}

src/components/models/SchemaViewer.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ const jsonSchemaTree = new SchemaTree(schema, {
5353
jsonSchemaTree.populate();
5454
---
5555

56-
<ul class="m-0 list-none p-0">
56+
<ul class="pl-0">
5757
{
5858
(jsonSchemaTree.root.children[0] as RegularNode).children?.map(
59-
(node: SchemaNode) => <SchemaRow node={node} root />,
59+
(node: SchemaNode) => <SchemaRow node={node} />,
6060
)
6161
}
6262
</ul>

0 commit comments

Comments
 (0)