// Framework for drawer grid generation
// Parallel to the grid framework of bootstrap
// uses any value of `@grid-columns`


.dw-base(@index) {
  width: percentage((@index / @grid-columns));
}

.calc-drawer-column(@index, @class, @type) when (@type = width) and (@index > 0) {

  .dw-@{class}-@{index} {
    width: percentage((@index / @grid-columns));
  }


  .fold.dw-@{class}-@{index} {
    margin-left: -1 * percentage((@index / @grid-columns));;
  }

  .drawer-right {
    &.fold.dw-@{class}-@{index} {
      // margin-left: 0;
      margin-right: -1 * percentage((@index / @grid-columns));
    }
  }
}

// Basic looping in LESS
.loop-drawer-columns(@index, @class, @type) when (@index >= 0) {
  .calc-drawer-column(@index, @class, @type);
  .loop-drawer-columns((@index - 1), @class, @type);
}

// Create grid for specific class
.make-drawer(@class) {
  .loop-drawer-columns(@grid-columns, @class, width);
}