index.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <html>
  2. <head>
  3. <script defer src="dist/demo/index.js"></script>
  4. <style type="text/css">
  5. body {
  6. max-width: 800px;
  7. margin: 20px auto;
  8. font-family: sans-serif;
  9. }
  10. .gh {
  11. text-align: right;
  12. }
  13. .result h3 + div {
  14. border: 1px solid lightgray;
  15. border-radius: 5px;
  16. padding: 10px;
  17. }
  18. h1 code {
  19. font-size: 2em;
  20. }
  21. pre {
  22. font-size: 1.5rem;
  23. background: #efefef;
  24. padding: 1em;
  25. }
  26. textarea {
  27. font-family: monospace;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <div class="intro">
  33. <div class="gh">
  34. <iframe
  35. src="http://ghbtns.com/github-btn.html?user=mohsen1&repo=json-formatter-js&type=watch&size=large&count=true"
  36. frameborder="0"
  37. width="170"
  38. height="30"
  39. scrolling="0">
  40. </iframe>
  41. <iframe
  42. src="http://ghbtns.com/github-btn.html?user=mohsen1&repo=json-formatter-js&type=fork&size=large&count=true"
  43. frameborder="0"
  44. width="170"
  45. height="30"
  46. scrolling="0">
  47. </iframe>
  48. </div>
  49. <h1><code>JSONFormatter</code></h1>
  50. <p>
  51. Render JSON objects in HTML with a <b>collapsible</b> navigation.
  52. </p>
  53. <p><b><a href="https://github.com/mohsen1/json-formatter-js">JSON Formatter project on GitHub</a></b></p>
  54. </div>
  55. <h2>Usage</h2>
  56. <div class="usage">
  57. <p>Simple usage in ES6</p>
  58. <pre>
  59. import JSONFormatter from 'json-formatter-js'
  60. const myJSON = {ans: 42};
  61. const formatter = new JSONFormatter(myJSON);
  62. document.body.appendChild(formatter.render());
  63. </pre>
  64. </div>
  65. <h2>Playground</h2>
  66. <div class="playground">
  67. <p>Updating the JSON value in this textarea renders a new formatter on the right.</p>
  68. <table>
  69. <tr>
  70. <td>
  71. <textarea id="live" name="" id="" cols="30" rows="10">{"foo": 42}</textarea>
  72. </td>
  73. <td>
  74. <div id="live-result"></div>
  75. </td>
  76. </tr>
  77. <tr>
  78. <p>
  79. <input type="checkbox" id="hoverPreviewEnabled">
  80. <label for="hoverPreviewEnabled"><code>hoverPreviewEnabled</code></label>
  81. </p>
  82. </tr>
  83. </table>
  84. </div>
  85. <h2>Examples</h2>
  86. <div class="result"></div>
  87. </body>
  88. </html>