UNPKG

2.59 kBSCSSView Raw
1/// Modifies a grid to give it "frame" behavior (no overflow, no wrap, stretch behavior)
2///
3/// @param {Boolean} $vertical [false] - Is grid vertical or horizontal. Should match grid.
4/// @param {Boolean} $nested [false] - Is grid nested or not. If nested is true this sets the frame to 100% height, otherwise will be 100vh.
5/// @param {Number|Map} $gutters [null] - Map or single value for gutters.
6/// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from.
7/// @param {Boolean} $include-base [true] - Include the base styles that don't vary per breakpoint.
8@mixin xy-grid-frame(
9 $vertical: false,
10 $nested: false,
11 $gutters: null,
12 $breakpoint: null,
13 $include-base: true
14) {
15
16 @if $include-base {
17 overflow: hidden;
18 position: relative;
19 flex-wrap: nowrap;
20 align-items: stretch;
21 }
22
23 @if $breakpoint == null and type-of($gutters) == 'map' {
24 @include -zf-each-breakpoint() {
25 @include xy-grid-frame($vertical, $nested, $gutters, $-zf-size, false);
26 }
27 } @else {
28 // Get our gutters if applicable
29 $gutter: -zf-get-bp-val($gutters, $breakpoint);
30
31 // If we have a gutter, add it to the width/height
32 @if $gutter {
33 @if $vertical == true {
34 $unit: if($nested == true, 100%, 100vh);
35 $gutter: rem-calc($gutter);
36 height: calc(#{$unit} + #{$gutter});
37 } @else {
38 $unit: if($nested == true, 100%, 100vw);
39 $gutter: rem-calc($gutter);
40 width: calc(#{$unit} + #{$gutter});
41 }
42 }
43 @else {
44 @if $vertical == true {
45 height: if($nested == true, 100%, 100vh);
46 } @else {
47 width: if($nested == true, 100%, 100vw);
48 }
49 }
50 }
51}
52
53/// Modifies a cell to give it "block" behavior (overflow auto, inertial scrolling)
54///
55/// @param {Boolean} $vertical [false] - Is grid vertical or horizontal. Should match grid.
56@mixin xy-cell-block(
57 $vertical: false
58) {
59 $property: if($vertical == true, 'overflow-y', 'overflow-x');
60
61 @if $vertical == true {
62 overflow-y: auto;
63 max-height: 100%;
64 } @else {
65 overflow-x: auto;
66 max-width: 100%;
67 }
68
69 -webkit-overflow-scrolling: touch;
70 -ms-overflow-stype: -ms-autohiding-scrollbar;
71}
72
73/// Container for inside a grid frame containing multiple blocks. Typically used
74/// as a modifier for a `.cell` to allow the cell to pass along flex sizing
75/// constraints / from parents to children.
76@mixin xy-cell-block-container() {
77 display: flex;
78 flex-direction: column;
79 max-height: 100%;
80
81 > .grid-x {
82 max-height: 100%;
83 flex-wrap: nowrap;
84 }
85}