Sha256: 465cd485999fdc63ac52c077d02f46c9c6fe99f5837e244040fb9f7e549f3469

Contents?: true

Size: 1.53 KB

Versions: 67

Compression:

Stored size: 1.53 KB

Contents

@charset "UTF-8";

/// Translates an element horizontally by a number of columns. Positive arguments shift the element to the active layout direction, while negative ones shift it to the opposite direction.
///
/// @param {Number (unitless)} $n-columns [1]
///   Number of columns by which the element shifts.
///
/// @example scss - Usage
///   .element {
///     @include shift(-3);
///   }
///
/// @example css - CSS output
///   .element {
///     margin-left: -25.58941%;
///   }

@mixin shift($n-columns: 1) {
  @include shift-in-context($n-columns);
}

/// Translates an element horizontally by a number of columns, in a specific nesting context.
///
/// @param {List} $shift
///   A list containing the number of columns to shift (`$columns`) and the number of columns of the parent element (`$container-columns`).
///
///   The two values can be separated with any string such as `of`, `/`, etc.
///
/// @example scss - Usage
///   .element {
///     @include shift(-3 of 6);
///   }
///
/// @example css - CSS output
///   .element {
///     margin-left: -52.41458%;
///   }

@mixin shift-in-context($shift: $columns of $container-columns) {
  $n-columns: nth($shift, 1);
  $parent-columns: container-shift($shift) !global;

  $direction: get-direction($layout-direction, $default-layout-direction);
  $opposite-direction: get-opposite-direction($direction);

  margin-#{$opposite-direction}: $n-columns * flex-grid(1, $parent-columns) + $n-columns * flex-gutter($parent-columns);

  // Reset nesting context
  $parent-columns: $grid-columns !global;
}

Version data entries

67 entries across 60 versions & 14 rubygems

Version Path
uswds-jekyll-1.4.1 _sass/uswds/lib/grid/_shift.scss
uswds-jekyll-1.4.1 assets/uswds/scss/lib/grid/_shift.scss
neat-1.9.0 app/assets/stylesheets/grid/_shift.scss
wayfarer-jruby-0.0.3 docs/_sass/vendor/neat/grid/_shift.scss
wayfarer-0.0.3 docs/_sass/vendor/neat/grid/_shift.scss
wayfarer-jruby-0.0.2 docs/_sass/vendor/neat/grid/_shift.scss
wayfarer-jruby-0.0.1 docs/_sass/vendor/neat/grid/_shift.scss
dta_rapid-0.3.5 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.3.4 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.3.3 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.3.2 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.3.1 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.3.0 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.2.18 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.2.17 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.2.16 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.2.15 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.2.14 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.2.13 _sass/vendor/neat/grid/_shift.scss
dta_rapid-0.2.12 _sass/vendor/neat/grid/_shift.scss