Sha256: 8db565068a8bacefe32639e9bfd7a3d45cae4af3fb9f44c0b5340be41e6e4d1d

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

/// 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

15 entries across 15 versions & 2 rubygems

Version Path
active_admin_pro-0.2.4 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.2.3 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.2.2 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.2.1 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.2.0 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.8 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.7 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.6 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.5 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.4 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.3 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.2 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.1 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
active_admin_pro-0.1.0 app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss
neat-1.7.0 app/assets/stylesheets/grid/_shift.scss