leroy merlin

listing grid preview

by Grzegorz Matyszewski

HTML

<header class="header"><h1>Leroy Merlin</h1></header>
<main class="content has-sidebar">
  <div class="grid">
    <ul>
      <li class="column"></li><!--
   --><li class="column"></li><!--
   --><li class="column"></li><!--
   --><li class="column"></li><!--
   --><li class="column"></li><!--
   --><li class="column"></li><!--
   --><li class="column"></li><!--
   --><li class="column"></li>
    </ul>
  </div>
  <div class="sidebar"></div>
</main>

SCSS

/* Leroy Merlin - grid preview
===============================
Note: this is not working prototype of grid elements,
just visualisation how columns should
be displayed in different window sizes.
[email protected]
*/

$column-width: 200px;
$column-gap: 40px;
$left-margin: 60px;
$right-margin: 60px;

$bp-3c: 2*$column-width + $column-gap + $left-margin + $right-margin + $column-width + $column-gap;
$bp-2c: 2*$column-width + $column-gap + $left-margin + $right-margin;

body {
  text-align: center;
  font-family: sans-serif;
  font-size: 12px;
  background: white;
  /* overflow: hidden; */ //jsfiddle mediaqueries bug

  &:before, &:after {
    border-color: red;
    border-width: 0 30px 0 30px;
    border-style: solid;
    background: white;
    width: 1px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: -1px;
    opacity: 0.05;
    z-index: 1;
    content: '';
  }
  &:after {
    right: -1px;
    left: auto;
  }
}

.header {
  width: 100%;
  height: 80px;
  display: block;
  padding: 10px 30px;
  box-sizing: border-box;
}

h1 {
  text-align: left;
  border-bottom: 1px solid black;
  line-height: 50px;
  font-weight: 600;
}

.content {
  display: block;
  position: relative;
  overflow: hidden;
  &.has-sidebar {
    padding-left: $left-margin+$column-width+$column-gap;
    padding-right: $right-margin;
    @media (max-width: $bp-3c){
      padding-left: $left-margin;
    }
  }
}

.grid {
  position: relative;
  margin: auto;
  /* outline: 1px solid red; */
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  
  @for $i from 1 through 8 {
    $wdt: ($i+1)*$column-width + $i*$column-gap;
    $bp: $wdt + $left-margin + $right-margin + $column-width + $column-gap;
    @media (min-width: $bp){
      max-width: $wdt;
    }
  }
  ul {
    margin-bottom: 1px;
    margin: 0 -0.5*$column-gap 1px;
  }
}

.column {
  width: $column-width;  
  display: inline-block;
  vertical-align: top;
  margin: 0 $column-gap*0.5;
  background: rgba(255,0,0,0.22);
 ...