|
1 | 1 | --- |
2 | | -import { Type } from "~/components"; |
| 2 | +import { Type, MetaInfo } from "~/components"; |
3 | 3 | import { type SchemaNode } from "@stoplight/json-schema-tree"; |
4 | 4 |
|
5 | | -const { node } = Astro.props; |
| 5 | +const { node, root } = Astro.props; |
6 | 6 | --- |
7 | 7 |
|
8 | | -<li class="my-2 !list-none"> |
9 | | - <code class="mr-2 font-mono rounded-md bg-gray-100"> |
10 | | - {node.subpath[node.subpath.length - 1]} |
11 | | - </code> |
| 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 | + node.title ? ( |
| 13 | + <span class="mr-2 font-bold">{node.title}</span> |
| 14 | + ) : ( |
| 15 | + <code class="mr-2 !pr-0 font-mono rounded-md bg-gray-100"> |
| 16 | + {node.subpath[node.subpath.length - 1]} |
| 17 | + </code> |
| 18 | + ) |
| 19 | + } |
| 20 | + |
12 | 21 | {node.primaryType && <Type text={node.primaryType} />} |
| 22 | + {node.combiners && node.combiners.includes("oneOf") && <Type text="one of" />} |
13 | 23 |
|
14 | 24 | { |
15 | 25 | node.annotations.default && ( |
16 | | - <span class="text-xs mr-2">default {node.annotations.default}</span> |
| 26 | + <MetaInfo text={`default ${node.annotations.default}`} /> |
17 | 27 | ) |
18 | 28 | } |
19 | 29 | { |
20 | 30 | (node.validations.minLength !== undefined || |
21 | 31 | node.validations.minimum !== undefined) && ( |
22 | | - <span class="text-xs mr-2"> |
23 | | - min {node.validations.minLength || node.validations.minimum} |
24 | | - </span> |
| 32 | + <MetaInfo |
| 33 | + text={`min ${node.validations.minLength || node.validations.minimum}`} |
| 34 | + /> |
25 | 35 | ) |
26 | 36 | } |
27 | 37 | { |
28 | 38 | (node.validations.maxLength !== undefined || |
29 | 39 | node.validations.maximum !== undefined) && ( |
30 | | - <span class="text-xs"> |
31 | | - max {node.validations.maxLength || node.validations.maximum} |
32 | | - </span> |
| 40 | + <MetaInfo |
| 41 | + text={`max ${node.validations.maxLength || node.validations.maximum}`} |
| 42 | + /> |
33 | 43 | ) |
34 | 44 | } |
35 | | - <p>{node.annotations.description}</p> |
| 45 | + <p class="!mb-0">{node.annotations.description}</p> |
36 | 46 |
|
37 | 47 | { |
38 | 48 | node.children && ( |
|
0 commit comments