Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional parameters to grid mixins for more flexibility #6230

Closed
wants to merge 6 commits into from
32 changes: 16 additions & 16 deletions less/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -534,28 +534,28 @@
}

// Table columns
.tableColumns(@columnSpan: 1) {
.tableColumns(@columnSpan: 1, @columnWidth: @gridColumnWidth, @gutterWidth: @gridGutterWidth) {
float: none; // undo default grid column styles
width: ((@gridColumnWidth) * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)) - 16; // 16 is total padding on left and right of table cells
width: ((@columnWidth) * @columnSpan) + (@gutterWidth * (@columnSpan - 1)) - 16; // 16 is total padding on left and right of table cells
margin-left: 0; // undo default grid column styles
}

// Make a Grid
// Use .makeRow and .makeColumn to assign semantic layouts grid system behavior
.makeRow() {
margin-left: @gridGutterWidth * -1;
.makeRow(@gutterWidth: @gridGutterWidth) {
margin-left: @gutterWidth * -1;
.clearfix();
}
.makeColumn(@columns: 1, @offset: 0) {
.makeColumn(@columns: 1, @offset: 0, @columnWidth: @gridColumnWidth, @gutterWidth: @gridGutterWidth) {
float: left;
margin-left: (@gridColumnWidth * @offset) + (@gridGutterWidth * (@offset - 1)) + (@gridGutterWidth * 2);
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
margin-left: (@columnWidth * @offset) + (@gutterWidth * (@offset - 1)) + (@gutterWidth * 2);
width: (@columnWidth * @columns) + (@gutterWidth * (@columns - 1));
}

// The Grid
#grid {

.core (@gridColumnWidth, @gridGutterWidth) {
.core (@gridColumnWidth, @gridGutterWidth, @cols: @gridColumns) {

.spanX (@index) when (@index > 0) {
(~".span@{index}") { .span(@index); }
Expand Down Expand Up @@ -592,15 +592,15 @@
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container { .span(@gridColumns); }
.navbar-fixed-bottom .container { .span(@cols); }

// generate .spanX and .offsetX
.spanX (@gridColumns);
.offsetX (@gridColumns);
.spanX (@cols);
.offsetX (@cols);

}

.fluid (@fluidGridColumnWidth, @fluidGridGutterWidth) {
.fluid (@fluidGridColumnWidth, @fluidGridGutterWidth, @cols: @gridColumns) {

.spanX (@index) when (@index > 0) {
(~".span@{index}") { .span(@index); }
Expand Down Expand Up @@ -649,13 +649,13 @@
}

// generate .spanX and .offsetX
.spanX (@gridColumns);
.offsetX (@gridColumns);
.spanX (@cols);
.offsetX (@cols);
}

}

.input(@gridColumnWidth, @gridGutterWidth) {
.input(@gridColumnWidth, @gridGutterWidth, @cols: @gridColumns) {

.spanX (@index) when (@index > 0) {
(~"input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index}") { .span(@index); }
Expand All @@ -679,7 +679,7 @@
}

// generate .spanX
.spanX (@gridColumns);
.spanX (@cols);

}

Expand Down