-
Notifications
You must be signed in to change notification settings - Fork 60
Add custom buttons to rows according to value type #79
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
base: master
Are you sure you want to change the base?
Add custom buttons to rows according to value type #79
Conversation
* chore: update project version * chore: add contributor to project
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
package.json
Outdated
@@ -2,7 +2,7 @@ | |||
"name": "@microlink/react-json-view", | |||
"description": "Interactive react component for displaying javascript arrays and JSON objects.", | |||
"homepage": "https://github.com/microlinkhq/react-json-view", | |||
"version": "1.26.2", | |||
"version": "1.26.3", |
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.
The version will incremented before merging the PR.
Pleae don't increment the version in the PR!
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.
You're right, it comes from the git flow I use in my fork. I will solve it.
Can you add a brief explanation of what is the PR doing? 🙏 |
Yes, sorry, I missed time yesterday but it was planned. Now it's done! 😄 |
Okay, now I see what you want to ship, thanks! you are repeating the same button multiple times to make it available for more than one token – that's telling us the interface for that feature is not the best. What do you think about something more like this? import JsonViewer, { defaultButtons } from 'react-json-view'
<JsonViewer
buttons={[
...defaultButtons, // it could be also possible to pick individual buttons
{
button: () => <PrintButton onClick={(element) => { console.log(JSON.stringify(element, null, 4)) }} />,
scope: ['boolean', 'string'],
}
]}
/> |
This feature adds custom buttons to each row in the JSON viewer, depending on the value type of the row (e.g., string, number, object, etc.).
The feature was previously suggested by @chad-autry in this issue : mac-s-g/react-json-view#354.
Summary of changes:
This enhancement allows for more interactive and actions between an application and this module.