Skip to content

Extra function replaceColumnFlex

Pre-release
Pre-release

Choose a tag to compare

@d4lek d4lek released this 05 Sep 13:29
· 40 commits to master since this release

Adds possibility to accept columnFlex prop as a multidimensional array and function replaceColumnFlex to switch between those arrays.

Note: the first item in an array will always be the default

Example

  const initialColumns = [
      ['0 0 25%', '1 1 75%'],
      ['0 0 25%', '1 1 50%', '0 0 25%'],
      ['0 0 20%', '1 1 40%', '0 0 20%', '0 0 20%'],
    ]

  const columns = [{}, {}, {}]

  <DataBrowser
    initialColumnFlex={initialColumns}
    columns={columns}
    totalItems={columns.length}
  >
  {({replaceColumnFlex, availableColumnFlex}) => (
    <button 
      onClick={() => replaceColumnFlex({ columnFlex: availableColumnFlex[1] })}
    >
      click me
    </button>
  )}
  </DataBrowser>