Skip to content

Commit

Permalink
Merge pull request #231 from jy95/jy95-patch-1
Browse files Browse the repository at this point in the history
feat: ValueComponent to customize value rendering
  • Loading branch information
jy95 authored Dec 19, 2023
2 parents 24e4260 + f272aa1 commit 5b7600d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions testsite/docs/demo-viewer/custom/values.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TabItem from "@theme/TabItem"

// if schema defines a default value, ensure it is bold wherever it
// appears (e.g. in an enum)
if (value === schema.default) {
if (schema.default && value === schema.default) {
return <strong>{component}</strong>
}

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

// if schema defines a default value, ensure it is bold wherever it
// appears (e.g. in an enum)
if (value === schema.default) {
if (schema.default && value === schema.default) {
return <strong>{component}</strong>
}

Expand Down
13 changes: 12 additions & 1 deletion testsite/static/schemas/examples/custom/values.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
"customField": {
"type": "string",
"description": "A customized or personalized field",
"enum": ["palette", "teddyBear", "tools", "laptop", "thread", "phone", "puzzle", "scissors", "hammer", "note"],
"enum": [
"palette",
"teddyBear",
"tools",
"laptop",
"thread",
"phone",
"puzzle",
"scissors",
"hammer",
"note"
],
"default": "palette",
"examples": ["tools", "note"]
},
Expand Down

0 comments on commit 5b7600d

Please sign in to comment.