/examples/vars.js

https://github.com/STRML/react-grid-layout · JavaScript · 157 lines · 156 code · 1 blank · 0 comment · 0 complexity · 65448a41debc73181fbfac6d00df035e MD5 · raw file

  1. "use strict";
  2. module.exports = [
  3. {
  4. title: "Showcase",
  5. source: "showcase",
  6. paragraphs: [
  7. "React-Grid-Layout is a grid layout system for React. It features auto-packing, draggable and resizable " +
  8. "widgets, static widgets, a fluid layout, and separate layouts per responsive breakpoint.",
  9. "Try it out! Drag some boxes around, resize them, and resize the window to see the responsive breakpoints."
  10. ]
  11. },
  12. {
  13. title: "Basic",
  14. source: "basic",
  15. paragraphs: [
  16. "Try dragging the elements around.",
  17. "This is a basic, non-responsive layout with dragging and resizing. Usage is very simple."
  18. ]
  19. },
  20. {
  21. title: "No Dragging",
  22. source: "no-dragging",
  23. paragraphs: [
  24. "This particular example has dragging and resizing turned off."
  25. ]
  26. },
  27. {
  28. title: "Messy",
  29. source: "messy",
  30. paragraphs: [
  31. "This demo shows what happens when elements are placed randomly all over the layout.",
  32. "RGL does not auto-pack in the same fashion as other projects, such as jQuery Masonry. Packing is only done " +
  33. "in the vertical dimension. If objects all have the same width, they will be packed efficiently.",
  34. "If a layout is fed to RGL that has items with incorrect dimensions (width too big, overlapping other elements, " +
  35. "out of bounds, etc), they will be automatically corrected on startup. See the " +
  36. "source of this demo, where elements are placed randomly in the layout."
  37. ]
  38. },
  39. {
  40. title: "Grid Item Properties",
  41. source: "grid-property",
  42. paragraphs: [
  43. "This demo uses a layout assigned on the grid items themselves as the <code>data-grid</code> property."
  44. ]
  45. },
  46. {
  47. title: "Static Elements",
  48. source: "static-elements",
  49. paragraphs: [
  50. "This demo sets an item to <code>static</code>. Static elements cannot be moved or resized. Other elements " +
  51. "move themselves around a static element."
  52. ]
  53. },
  54. {
  55. title: "Dynamic Add/Remove",
  56. source: "dynamic-add-remove",
  57. paragraphs: [
  58. "This demo shows what happens when items are dynamically added and removed.",
  59. 'You can remove an item by clicking its "x", and add a new one with the button.',
  60. "To further illustration RGL's capacities, this particular example is responsive. Trying resizing the window."
  61. ]
  62. },
  63. {
  64. title: "LocalStorage",
  65. source: "localstorage",
  66. paragraphs: [
  67. "This simple demo synchronizes to localStorage.",
  68. "Try moving and resizing elements, then reloading."
  69. ]
  70. },
  71. {
  72. title: "Responsive with LocalStorage",
  73. source: "localstorage-responsive",
  74. paragraphs: [
  75. "This simple demo synchronizes to localStorage for each responsive breakpoint.",
  76. "Try moving and resizing elements, changing window width, moving some more, and refreshing.",
  77. "Each breakpoint has a separate layout. The <code>onLayoutChange</code> callback calls back with " +
  78. "a hash of breakpoints to layouts, which is then synchronized to localStorage."
  79. ]
  80. },
  81. {
  82. title: "Minimum and Maximum Width/Height",
  83. source: "min-max-wh",
  84. paragraphs: [
  85. "You can set min and max dimensions on a grid item by using the `minW`, `maxW`, `minH`, and `maxH` properties.",
  86. "In this demo, the min and max dimensions are generated automatically. Try resizing the items below.",
  87. "If your mins and maxes collide: for example min > max, or the initial dimensions are out of range, " +
  88. "an error will be thrown."
  89. ]
  90. },
  91. {
  92. title: "Dynamic Minimum and Maximum Width/Height",
  93. source: "dynamic-min-max-wh",
  94. paragraphs: [
  95. "Your application may have more complex rules for determining an element's mins and maxes. This demo " +
  96. "demonstrates how to use the `onResize` handler to accomplish this.",
  97. "In this grid, all elements are allowed a max width of 2 if the height < 3, " +
  98. "and a min width of 2 if the height >= 3."
  99. ]
  100. },
  101. {
  102. title: "No Vertical Compacting (Free Movement)",
  103. source: "no-vertical-compact",
  104. paragraphs: [
  105. "You may want to turn off vertical compacting so items can be placed anywhere in the grid. Set the " +
  106. "property `verticalCompact` to `false` to achieve this effect."
  107. ]
  108. },
  109. {
  110. title: "Prevent Collision",
  111. source: "prevent-collision",
  112. paragraphs: [
  113. "You may want to turn off rearrangement so items don't move arround when dragging. Set the " +
  114. "property `preventCollision` to `true` to achieve this effect. " +
  115. "It's particularly useful with `verticalCompact` set to `false`."
  116. ]
  117. },
  118. {
  119. title: "Error Case",
  120. source: "error-case",
  121. paragraphs: [
  122. "This is an extra test case for a collision bug fixed in November 2017. When you drag 1 over 2, it should not " +
  123. "move over 3."
  124. ]
  125. },
  126. {
  127. title: "Toolbox",
  128. source: "toolbox",
  129. paragraphs: [
  130. "This demonstrates how to implement a toolbox to add and remove widgets. Click the 'X' on a widget to move it into the toolbox."
  131. ]
  132. },
  133. {
  134. title: "Drag From Outside",
  135. source: "drag-from-outside",
  136. paragraphs: [
  137. "This demo shows what happens when an item is added from outside of the grid.",
  138. "Once you drop the item within the grid you'll get its coordinates/properties and can perform actions with " +
  139. "it accordingly."
  140. ]
  141. },
  142. {
  143. title: "Bounded",
  144. source: "bounded",
  145. paragraphs: [
  146. "Try dragging the elements around. They can only be moved within the grid, the draggable placeholder will not show outside it."
  147. ]
  148. },
  149. {
  150. title: "Resizable Handles",
  151. source: "resizable-handles",
  152. paragraphs: [
  153. "This demonstrates how to implement resizable handles for any corner"
  154. ]
  155. }
  156. ];