vaheqelyan / svelte-grid

A responsive, draggable and resizable grid layout, for Svelte.
https://svelte-grid.now.sh/
MIT License
948 stars 57 forks source link

Documentation incomplete on `cols` prop #75

Open clozach opened 3 years ago

clozach commented 3 years ago

Quick aside: cool library! Thanks for sharing it. :)

The Usage docs claim that the cols prop should be a number representing the number of columns in the layout, but that doesn't seem to be the whole story. Many of the examples actually pass in a matrix, like in the Basic example:

const cols = [
  [ 1200, 6 ],
];

It would be helpful (and complete) to include an explanation of this matrix variant, especially as it relates to the hard-coded numerical item keys in those same examples, e.g.:

let items = [
  {
    6: gridHelp.item({ 
  //↑ This seems somehow related to the `6` in
  //  the previous `[1200, 6]`, right?
vaheqelyan commented 3 years ago

yes cols must be Array<Array<Number>>

you basically tell the grid to have 6 columns, when the width of the container is >= N (1200)

jkukatzki commented 1 year ago

then please fix the docs, this is so confusing my guy