Skip to content

Commit

Permalink
fix: allow types beside strings to inherit custom classname
Browse files Browse the repository at this point in the history
  • Loading branch information
haste8 authored Aug 5, 2024
1 parent 5d765bb commit e01894b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/json-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ export default function JsonNode({ node, depth, deleteHandle: _deleteHandle, ind
)

let className = 'json-view--string'

if (typeof (customReturn as CustomizeOptions)?.className === 'string') className += ' ' + (customReturn as CustomizeOptions).className


switch (type) {
case 'number':
case 'bigint':
Expand All @@ -185,6 +183,9 @@ export default function JsonNode({ node, depth, deleteHandle: _deleteHandle, ind
className = 'json-view--null'
break
}

if (typeof (customReturn as CustomizeOptions)?.className === 'string') className += ' ' + (customReturn as CustomizeOptions).className

if (deleting) className += ' json-view--deleting'

let displayValue = String(node)
Expand Down

0 comments on commit e01894b

Please sign in to comment.