| 1 |
// COMPONENT: GRID |
| 2 |
// Defines Grid and Item blocks |
| 3 |
|
| 4 |
@import "grid-api"; |
| 5 |
|
| 6 |
|
| 7 |
.#{$eps-prefix}grid { |
| 8 |
// Flex Structure rules |
| 9 |
// apply to all screen size |
| 10 |
// @props: container |
| 11 |
&-container { |
| 12 |
display: flex; |
| 13 |
flex-wrap: wrap; |
| 14 |
width: 100%; |
| 15 |
|
| 16 |
// @prop: no-wrap |
| 17 |
&--no-wrap { |
| 18 |
flex-wrap: nowrap; |
| 19 |
} |
| 20 |
|
| 21 |
&--wrap-reverse { |
| 22 |
flex-wrap: wrap-reverse; |
| 23 |
} |
| 24 |
|
| 25 |
// @prop: spacing[5,8,10,12,16] |
| 26 |
// defined within container only |
| 27 |
// item padding can be 8,10,12,16 |
| 28 |
// container width and negative margin are calculated dynamically |
| 29 |
// @markup <Grid container spacing={5} and so on > |
| 30 |
&--spacing { |
| 31 |
--grid-row-gutter: calc(-1 * #{$grid-spacing-gutter}); |
| 32 |
width: var(--grid-spacing-width); |
| 33 |
margin: var(--grid-row-gutter); |
| 34 |
|
| 35 |
> .#{$eps-prefix}grid-item { |
| 36 |
padding: var(--grid-spacing-gutter); |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
// - direction |
| 42 |
// @props: direction[ |
| 43 |
// 'row' |
| 44 |
// 'row-reverse' |
| 45 |
// 'column' |
| 46 |
// 'column-reverse' |
| 47 |
// ] |
| 48 |
&--direction { |
| 49 |
&-row { |
| 50 |
flex-direction: row; |
| 51 |
|
| 52 |
&-reverse { |
| 53 |
flex-direction: row-reverse; |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
&-column { |
| 58 |
flex-direction: column; |
| 59 |
|
| 60 |
&-reverse { |
| 61 |
flex-direction: column-reverse; |
| 62 |
} |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
// Flex alignments |
| 67 |
// @props: justifyContent[ |
| 68 |
// 'stretch' |
| 69 |
// 'start' |
| 70 |
// 'center' |
| 71 |
// 'end' |
| 72 |
// 'space-between' |
| 73 |
// 'space-around' |
| 74 |
// ] |
| 75 |
// default: 'stretch' |
| 76 |
&--justify { |
| 77 |
&-stretch { |
| 78 |
justify-content: stretch; |
| 79 |
} |
| 80 |
|
| 81 |
&-start { |
| 82 |
justify-content: flex-start; |
| 83 |
} |
| 84 |
|
| 85 |
&-center { |
| 86 |
justify-content: center; |
| 87 |
} |
| 88 |
|
| 89 |
&-end { |
| 90 |
justify-content: flex-end; |
| 91 |
} |
| 92 |
|
| 93 |
&-space-between { |
| 94 |
justify-content: space-between; |
| 95 |
} |
| 96 |
|
| 97 |
&-space-around { |
| 98 |
justify-content: space-around; |
| 99 |
} |
| 100 |
|
| 101 |
&-space-evenly { |
| 102 |
justify-content: space-evenly; |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
// @props: alignContent[ |
| 107 |
// 'stretch' |
| 108 |
// 'start' |
| 109 |
// 'center' |
| 110 |
// 'end' |
| 111 |
// 'space-between' |
| 112 |
// 'space-around' |
| 113 |
// ] |
| 114 |
// default: 'stretch' |
| 115 |
&--align-content { |
| 116 |
&-stretch { |
| 117 |
align-content: stretch; |
| 118 |
} |
| 119 |
|
| 120 |
&-start { |
| 121 |
align-content: flex-start; |
| 122 |
} |
| 123 |
|
| 124 |
&-center { |
| 125 |
align-content: center; |
| 126 |
} |
| 127 |
|
| 128 |
&-end { |
| 129 |
align-content: flex-end; |
| 130 |
} |
| 131 |
|
| 132 |
&-space-between { |
| 133 |
align-content: space-between; |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
// @props: alignItems[ |
| 138 |
// 'start' |
| 139 |
// 'center' |
| 140 |
// 'end' |
| 141 |
// 'baseline' |
| 142 |
// 'stretch' |
| 143 |
// ] |
| 144 |
// default: 'stretch' |
| 145 |
&--align-items { |
| 146 |
&-start { |
| 147 |
align-items: flex-start; |
| 148 |
} |
| 149 |
|
| 150 |
&-center { |
| 151 |
align-items: center; |
| 152 |
} |
| 153 |
|
| 154 |
&-end { |
| 155 |
align-items: flex-end; |
| 156 |
} |
| 157 |
|
| 158 |
&-baseline { |
| 159 |
align-items: baseline; |
| 160 |
} |
| 161 |
|
| 162 |
&-stretch { |
| 163 |
align-items: stretch; |
| 164 |
} |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
// - Grid Item assumes display flex and wrap on parent |
| 169 |
// - Defining Item Base Properties |
| 170 |
// - Generating flex item traits within @media breakpoints |
| 171 |
|
| 172 |
// Zero min width to disable overflow while container is no wrap |
| 173 |
|
| 174 |
// @prop: ZeroMinWidth |
| 175 |
// @markup <Grid item zeroMinWidth> or <Grid item sm> and so on.. |
| 176 |
.#{$eps-prefix}grid-item--zero-min-width { |
| 177 |
min-width: 0; |
| 178 |
} |
| 179 |
|
| 180 |
// Item flex sizing, auto grid |
| 181 |
// @prop: [xs,sm,md,lg,xl,xxl] |
| 182 |
// @markup <Grid item xs> or <Grid item sm> and so on.. |
| 183 |
// No need for container: |
| 184 |
// @prop: [xs={@num<=12}],sm={@num<=12},md={@num<=12},lg={@num<=12},xl={@num<=12},xxl={@num<=12}] |
| 185 |
// @markup <Grid item xs={4}> or <Grid item sm={3}> and so on.. |
| 186 |
@each $breakpoint in map-keys($breakpoints) { |
| 187 |
@media screen and (min-width: #{map-get($breakpoints, $breakpoint)}) { |
| 188 |
@include grid-item-auto($breakpoint); |
| 189 |
} |
| 190 |
} |
| 191 |
|
| 192 |
// Generating cols per each media breakpoint |
| 193 |
@include grid-col-generator(xs); |
| 194 |
|
| 195 |
@media screen and (min-width: $editor-screen-sm-min) { |
| 196 |
@include grid-col-generator(sm); |
| 197 |
} |
| 198 |
|
| 199 |
@media screen and (min-width: $editor-screen-md-min) { |
| 200 |
@include grid-col-generator(md); |
| 201 |
} |
| 202 |
|
| 203 |
@media screen and (min-width: $editor-screen-lg-min) { |
| 204 |
@include grid-col-generator(lg); |
| 205 |
} |
| 206 |
|
| 207 |
@media screen and (min-width: $editor-screen-xl-min) { |
| 208 |
@include grid-col-generator(xl); |
| 209 |
} |
| 210 |
|
| 211 |
@media screen and (min-width: $editor-screen-xxl-min) { |
| 212 |
@include grid-col-generator(xxl); |
| 213 |
} |
| 214 |
|