_omega.scss 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Remove last element gutter
  2. @mixin omega($query: block, $direction: default) {
  3. $table: if(belongs-to(table, $query), true, false);
  4. $auto: if(belongs-to(auto, $query), true, false);
  5. @if $direction != default {
  6. @warn "The omega mixin will no longer take a $direction argument. To change the layout direction, use row($direction) or set $default-layout-direction instead."
  7. } @else {
  8. $direction: get-direction($layout-direction, $default-layout-direction);
  9. }
  10. @if $table {
  11. @warn "The omega mixin no longer removes padding in table layouts."
  12. }
  13. @if length($query) == 1 {
  14. @if $auto {
  15. &:last-child {
  16. margin-#{$direction}: 0;
  17. }
  18. }
  19. @else if contains-display-value($query) and $table == false {
  20. margin-#{$direction}: 0;
  21. }
  22. @else {
  23. @include nth-child($query, $direction);
  24. }
  25. }
  26. @else if length($query) == 2 {
  27. @if $auto {
  28. &:last-child {
  29. margin-#{$direction}: 0;
  30. }
  31. }
  32. @else {
  33. @include nth-child(nth($query, 1), $direction);
  34. }
  35. }
  36. @else {
  37. @warn "Too many arguments passed to the omega() mixin."
  38. }
  39. }
  40. @mixin nth-child($query, $direction) {
  41. $opposite-direction: get-opposite-direction($direction);
  42. &:nth-child(#{$query}) {
  43. margin-#{$direction}: 0;
  44. }
  45. @if type-of($query) == number {
  46. &:nth-child(#{$query}+1) {
  47. clear: $opposite-direction;
  48. }
  49. }
  50. }