_grid.less 2.33 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
// /**
//  * Copyright © Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//
//  Default Grid
//  _____________________________________________

//
//  Variables
//  _____________________________________________

//  Number of columns in the grid
@grid-columns: 12;
@grid-gutter-width: 0;

//  Form Fields Grid Sketch grid
@temp_gutter: 30px;
@temp_columns: 12;

//
//  Row
//  ---------------------------------------------

//  Rows contain and clear the floats of your columns.
.row {
    .make-row();
}

//
//  Columns
//  ---------------------------------------------

//  Common styles for small and large grid columns
.make-grid-columns();

//  Extra small grid
//  Columns, offsets, pushes, and pulls for extra small devices like smartphones.
.make-grid(xs);

//  Small grid
//  Columns, offsets, pushes, and pulls for the small device range, from phones to tablets.
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .make-grid(m);
}

//  Medium grid
//  Columns, offsets, pushes, and pulls for the desktop device range.
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
    .make-grid(l);
}

//  Large grid
//  Columns, offsets, pushes, and pulls for the large desktop device range.
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__xl) {
    .make-grid(xl);
}

//
//  Gutter
//  ---------------------------------------------

.row-gutter {
    margin-left: -(@content__indent / 2);
    margin-right: -(@content__indent / 2);
    > [class*='col-'] {
        padding-left: @content__indent / 2;
        padding-right: @content__indent / 2;
    }
}

//
//  Form Fields Grid Sketch
//  _____________________________________________

#mix-grid() {
    .row() {
        .lib-clearer();
        margin-left: ~'-@{temp_gutter}';
    }

    .return_length(@_columns-min, @_total: @temp_columns, @mathSymbol: '-') {
        @_part: @_columns-min/@_total;
        @_length: ~'calc( (100%) * @{_part} @{mathSymbol} @{temp_gutter} )';
    }

    .width(@_columns-min, @_total: @temp_columns) {
        #mix-grid .return_length(@_columns-min, @_total);
        width: @_length;
    }

    .column(@_columns-min, @_total: @temp_columns) {
        #mix-grid .width(@_columns-min, @_total);
        float: left;
        margin-left: @temp_gutter;
    }
}