avalanche icon indicating copy to clipboard operation
avalanche copied to clipboard

Responsive gutter classes

Open colourgarden opened this issue 10 years ago • 6 comments

In response to a tweet - would anyone find responsive gutter classes like .grid--small--portable useful?

Currently, Avalanche has .grid--small etc where the gutter width can be modified for a grid but maybe there is a need for these to be controlled at a breakpoint level as well?

To achieve this, add a new Sass map to settings for the required gutters:

$av-gutters:  (
  "tiny":   0.25,
  "small":  0.5,
  "large":  2,
  "huge":   4
);

Then loop through these and the breakpoints to create the responsive breakpoint gutter classes:

@each $alias, $query in $av-breakpoints{
  @media #{$query}{
    @each $gutter-alias, $multiplier in $av-gutters{
      .#{$av-namespace}--#{$gutter-alias}--#{$alias}{
        margin-left: -($av-gutter * $multiplier);

        > .#{$av-namespace}__cell{
          padding-left: ($av-gutter * $multiplier);
        }
      }
    }
  }
}

colourgarden avatar Mar 10 '16 14:03 colourgarden

yes, thanks a lot, we implement your avalanche grid system in your framework: http://sandbox.devbea.fr/bff_avalanche/html/05-grid-avalanche.php

Merci

igaman avatar Mar 17 '16 14:03 igaman

@igaman Hi. There's authentication on the link you sent so I can't access.

colourgarden avatar Mar 21 '16 19:03 colourgarden

I currently need it. I would like to be able to set/unset a grid--right depending the breakpoint. I think it would make sense to include that in the core of Avalanche ⚡️

GesJeremie avatar Jun 21 '17 19:06 GesJeremie

Something like that:

@if $av-enable-grid-center {

    @each $alias, $query in $av-breakpoints {
        @media #{$query} {

            .#{avCreateBlockClassName('center')}-at-#{$alias} {
                text-align: center;

                > .#{avCreateElementClassName()} {
                    text-align: left;
                }
            }

        }
    }
}

@if $av-enable-grid-right {

    @each $alias, $query in $av-breakpoints {
        @media #{$query} {

            .#{avCreateBlockClassName('right')}-at-#{$alias} {
              text-align: right;

              > .#{avCreateElementClassName()} {
                text-align: left;
              }
            }

        }
    }

}

GesJeremie avatar Jun 21 '17 20:06 GesJeremie

Hi @GesJeremie. Could you submit a PR for this? Seems like a good option.

colourgarden avatar Jun 26 '17 11:06 colourgarden

https://github.com/colourgarden/avalanche/issues/33

colourgarden avatar Jun 28 '17 07:06 colourgarden