-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a JSON tree visualizer #10579
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR introduces a comprehensive JSON tree visualizer component that renders JSON data in an interactive, collapsible tree structure with appropriate visual styling and icons for different data types.
- Created a modular component architecture with specialized renderers for different JSON types (arrays, objects, primitives) in
JsonArrayNode.tsx
,JsonObjectNode.tsx
, andJsonValueNode.tsx
- Implemented collapsible tree functionality with smooth animations using
JsonArrow.tsx
and Framer Motion - Added proper indentation and hierarchical display with
JsonList.tsx
that adjusts padding based on nesting depth - Included type-specific icons from Tabler Icons to visually distinguish between different JSON data types
- Created comprehensive Storybook stories in
JsonTree.stories.tsx
demonstrating all supported JSON structures and nesting patterns
14 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
return ( | ||
<JsonValueNode | ||
label={label} | ||
valueAsString="[null]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The '[null]' string representation for null values includes square brackets which might be confusing as it suggests an array. Consider using just 'null' for clarity.
label?: never; | ||
Icon?: any; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Icon type is set to any
which loses type safety. Consider using IconComponent | undefined
instead for better type checking.
label?: never; | |
Icon?: any; | |
} | |
label?: never; | |
Icon?: IconComponent | undefined; | |
} |
8a18fa6
to
7680b0d
Compare
Inspired by https://github.com/reduxjs/redux-devtools/tree/main/packages/react-json-tree
Demo
CleanShot.2025-02-28.at.15.36.16.mp4