Debian Codegraph @

node/@patternfly/patternfly/layouts/Grid/grid.scss

raw
1 @use '../../sass-utilities' as *;
2
3 $pf-v6-l-grid--breakpoint-map: build-breakpoint-map(); // currently only used for css variable stack
4
5 // URL.com/guidelines#layout
6 // Generate smart grid layout
7 // @parameter {Suffix} xs, sm, md, lg, xl, null
8 @mixin pf-smart-grid($suffix: null) {
9 @for $col-num from 1 through 12 {
10 &.pf-m-all-#{$col-num}-col#{$suffix} {
11 > * {
12 --#{$grid}__item--GridColumnEnd: span #{$col-num};
13 }
14 }
15 }
16 }
17
18 // Creates grid item
19 // @parameter {Suffix} xs, sm, md, lg, xl, null
20 @mixin pf-grid-item-modifier($suffix: null) {
21 // generate column span modifier
22 @for $col-num from 1 through 12 {
23 > .pf-m-#{$col-num}-col#{$suffix} {
24 --#{$grid}__item--GridColumnEnd: span #{$col-num};
25 }
26 }
27
28 // generate column offset modfiers
29 @for $col-num from 1 through 12 {
30 > .pf-m-offset-#{$col-num}-col#{$suffix} {
31 --#{$grid}__item--GridColumnStart: col-start calc(#{$col-num} + 1);
32 }
33 }
34
35 // generate row span modfiers
36 @for $row-num from 1 through 12 {
37 > .pf-m-#{$row-num}-row#{$suffix} {
38 grid-row: span #{$row-num};
39 }
40 }
41 }
42
43 // Grid base
44 @include pf-root($grid) {
45 --#{$grid}--m-gutter--GridGap: var(--pf-t--global--spacer--gutter--default);
46 --#{$grid}__item--GridColumnStart: auto;
47 --#{$grid}__item--GridColumnEnd: span 12;
48 --#{$grid}--item--Order: 0;
49 }
50
51 .#{$grid} {
52 display: grid;
53 grid-template-columns: repeat(12, [col-start] 1fr);
54
55 > *,
56 .#{$grid}__item {
57 grid-column-start: var(--#{$grid}__item--GridColumnStart);
58 grid-column-end: var(--#{$grid}__item--GridColumnEnd);
59 min-width: 0;
60 min-height: 0;
61
62 @include pf-v6-build-css-variable-stack("order", "--#{$grid}--item--Order", $pf-v6-l-grid--breakpoint-map);
63 }
64
65 // Loop through $breakpoints map to generate responsive classes
66 @each $breakpoint, $value in $pf-v6-global--breakpoint-map {
67 @include pf-v6-media-query($breakpoint) {
68 @include pf-smart-grid($value);
69 }
70 }
71
72 // Loop through $breakpoints map to generate responsive classes
73 @each $breakpoint, $value in $pf-v6-global--breakpoint-map {
74 @include pf-v6-media-query($breakpoint) {
75 @include pf-grid-item-modifier($value);
76 }
77 }
78
79 &.pf-m-gutter {
80 gap: var(--#{$grid}--m-gutter--GridGap);
81 }
82 }