Skip to content

Commit 5b7600d

Browse files
authored
Merge pull request #231 from jy95/jy95-patch-1
feat: ValueComponent to customize value rendering
2 parents 24e4260 + f272aa1 commit 5b7600d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

testsite/docs/demo-viewer/custom/values.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import TabItem from "@theme/TabItem"
3030

3131
// if schema defines a default value, ensure it is bold wherever it
3232
// appears (e.g. in an enum)
33-
if (value === schema.default) {
33+
if (schema.default && value === schema.default) {
3434
return <strong>{component}</strong>
3535
}
3636

@@ -56,7 +56,7 @@ import TabItem from "@theme/TabItem"
5656

5757
// if schema defines a default value, ensure it is bold wherever it
5858
// appears (e.g. in an enum)
59-
if (value === schema.default) {
59+
if (schema.default && value === schema.default) {
6060
return <strong>{component}</strong>
6161
}
6262

testsite/static/schemas/examples/custom/values.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@
77
"customField": {
88
"type": "string",
99
"description": "A customized or personalized field",
10-
"enum": ["palette", "teddyBear", "tools", "laptop", "thread", "phone", "puzzle", "scissors", "hammer", "note"],
10+
"enum": [
11+
"palette",
12+
"teddyBear",
13+
"tools",
14+
"laptop",
15+
"thread",
16+
"phone",
17+
"puzzle",
18+
"scissors",
19+
"hammer",
20+
"note"
21+
],
1122
"default": "palette",
1223
"examples": ["tools", "note"]
1324
},

0 commit comments

Comments
 (0)