2016-04-27 20:44:36 +08:00
|
|
|
@import "../../style/mixins/index";
|
|
|
|
|
2015-06-09 18:22:52 +08:00
|
|
|
// mixins for grid system
|
|
|
|
// ------------------------
|
|
|
|
.make-row(@gutter: @grid-gutter-width) {
|
|
|
|
position: relative;
|
|
|
|
margin-left: (@gutter / -2);
|
|
|
|
margin-right: (@gutter / -2);
|
|
|
|
height: auto;
|
2016-04-27 20:44:36 +08:00
|
|
|
.clearfix;
|
2015-06-09 18:22:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.make-grid-columns() {
|
|
|
|
.col(@index) {
|
2016-03-07 21:03:17 +08:00
|
|
|
@item: ~".col-@{index}, .col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";
|
2015-06-09 18:22:52 +08:00
|
|
|
.col((@index + 1), @item);
|
|
|
|
}
|
|
|
|
.col(@index, @list) when (@index =< @grid-columns) {
|
2016-03-07 21:03:17 +08:00
|
|
|
@item: ~".col-@{index}, .col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";
|
2015-06-09 18:22:52 +08:00
|
|
|
.col((@index + 1), ~"@{list}, @{item}");
|
|
|
|
}
|
|
|
|
.col(@index, @list) when (@index > @grid-columns) {
|
|
|
|
@{list} {
|
|
|
|
position: relative;
|
2016-04-06 13:45:36 +08:00
|
|
|
// Prevent columns from collapsing when empty
|
|
|
|
min-height: 1px;
|
2015-06-09 18:22:52 +08:00
|
|
|
padding-left: (@grid-gutter-width / 2);
|
|
|
|
padding-right: (@grid-gutter-width / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.col(1);
|
|
|
|
}
|
|
|
|
|
2016-04-06 13:45:36 +08:00
|
|
|
.float-grid-columns(@class) {
|
|
|
|
.col(@index) { // initial
|
|
|
|
@item: ~".col@{class}-@{index}";
|
|
|
|
.col((@index + 1), @item);
|
|
|
|
}
|
|
|
|
.col(@index, @list) when (@index =< @grid-columns) { // general
|
|
|
|
@item: ~".col@{class}-@{index}";
|
|
|
|
.col((@index + 1), ~"@{list}, @{item}");
|
|
|
|
}
|
|
|
|
.col(@index, @list) when (@index > @grid-columns) { // terminal
|
|
|
|
@{list} {
|
|
|
|
float: left;
|
|
|
|
flex: 0 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.col(1); // kickstart it
|
|
|
|
}
|
|
|
|
|
2016-04-29 17:03:28 +08:00
|
|
|
// lesshint false
|
2016-03-07 21:03:17 +08:00
|
|
|
.loop-grid-columns(@index, @class) when (@index > 0) {
|
|
|
|
.col@{class}-@{index} {
|
2016-03-24 14:36:15 +08:00
|
|
|
display: block;
|
2015-06-09 18:22:52 +08:00
|
|
|
width: percentage((@index / @grid-columns));
|
|
|
|
}
|
2016-03-07 21:03:17 +08:00
|
|
|
.col@{class}-push-@{index} {
|
2015-06-09 18:22:52 +08:00
|
|
|
left: percentage((@index / @grid-columns));
|
|
|
|
}
|
2016-03-07 21:03:17 +08:00
|
|
|
.col@{class}-pull-@{index} {
|
2015-06-09 18:22:52 +08:00
|
|
|
right: percentage((@index / @grid-columns));
|
|
|
|
}
|
2016-03-07 21:03:17 +08:00
|
|
|
.col@{class}-offset-@{index} {
|
2015-06-09 18:22:52 +08:00
|
|
|
margin-left: percentage((@index / @grid-columns));
|
|
|
|
}
|
2016-03-07 21:03:17 +08:00
|
|
|
.col@{class}-order-@{index} {
|
2015-06-09 18:22:52 +08:00
|
|
|
order: @index;
|
|
|
|
}
|
2016-03-07 21:03:17 +08:00
|
|
|
.loop-grid-columns((@index - 1), @class);
|
2015-06-09 18:22:52 +08:00
|
|
|
}
|
|
|
|
|
2016-03-24 14:36:15 +08:00
|
|
|
.loop-grid-columns(@index, @class) when (@index = 0) {
|
|
|
|
.col@{class}-@{index} {
|
|
|
|
display: none;
|
|
|
|
}
|
2015-06-09 18:22:52 +08:00
|
|
|
.col-push-@{index} {
|
|
|
|
left: auto;
|
|
|
|
}
|
|
|
|
.col-pull-@{index} {
|
|
|
|
right: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-07 21:03:17 +08:00
|
|
|
.make-grid(@class: ~'') {
|
2016-04-06 13:45:36 +08:00
|
|
|
.float-grid-columns(@class);
|
2016-03-07 21:03:17 +08:00
|
|
|
.loop-grid-columns(@grid-columns, @class);
|
2016-02-20 16:33:01 +08:00
|
|
|
}
|