Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. .grid, .grid-flex {
  2. &.grid-gutter {
  3. margin-bottom: 50px;
  4. }
  5. }
  6.  
  7. .grid {
  8. display: grid;
  9. grid-gap: 25px;
  10. grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  11.  
  12. > .grid-cell {
  13. :last-child {
  14. margin-bottom: 0;
  15. }
  16.  
  17. &.horizontal-left {
  18. justify-self: start;
  19. }
  20.  
  21. &.horizontal-center {
  22. justify-self: center;
  23. }
  24.  
  25. &.horizontal-right {
  26. justify-self: end;
  27. }
  28.  
  29. &.vertical-top {
  30. align-self: start;
  31. }
  32.  
  33. &.vertical-center {
  34. align-self: center;
  35. }
  36.  
  37. &.vertical-bottom {
  38. align-self: end;
  39. }
  40.  
  41. &.row-span-2 {
  42. grid-row: span 2;
  43. }
  44.  
  45. @for $i from 1 to 12 {
  46. &.span-$i {
  47. grid-column: span $i;
  48. }
  49. }
  50. }
  51.  
  52. &.grid-spacing {
  53. margin-bottom: 30px;
  54. }
  55.  
  56. &.gap-none {
  57. grid-gap: 0;
  58. }
  59.  
  60. &.gap-small {
  61. grid-gap: 20px;
  62. }
  63.  
  64. &.gap-large {
  65. grid-gap: 40px;
  66. }
  67.  
  68. &.horizontal-left {
  69. justify-content: start;
  70. }
  71.  
  72. &.horizontal-center {
  73. justify-content: center;
  74. }
  75.  
  76. &.horizontal-right {
  77. justify-content: end;
  78. }
  79.  
  80. &.vertical-top {
  81. align-content: start;
  82. }
  83.  
  84. &.vertical-center {
  85. align-content: center;
  86. }
  87.  
  88. &.vertical-bottom {
  89. align-content: end;
  90. }
  91.  
  92. &.horizontal-items-left {
  93. justify-items: start;
  94. }
  95.  
  96. &.horizontal-items-center {
  97. justify-items: center;
  98. }
  99.  
  100. &.horizontal-items-right {
  101. justify-items: end;
  102. }
  103.  
  104. &.vertical-items-top {
  105. align-items: start;
  106. }
  107.  
  108. &.vertical-items-center {
  109. align-items: center;
  110. }
  111.  
  112. &.vertical-items-bottom {
  113. align-items: end;
  114. }
  115.  
  116. @for $i from 1 to 12 {
  117. &.columns-$i {
  118. grid-template-columns: repeat($i, 1fr);
  119. }
  120. }
  121.  
  122. @media <=map(bp, desktop) {
  123. &.desktop-columns-1 {
  124. grid-template-columns: repeat(1, 1fr);
  125. }
  126.  
  127. &.desktop-columns-2 {
  128. grid-template-columns: repeat(2, 1fr);
  129. }
  130. }
  131.  
  132. @media <=map(bp, mobile) {
  133. &.mobile-columns-1 {
  134. grid-template-columns: repeat(1, 1fr);
  135.  
  136. > .grid-cell[class*=span-] {
  137. grid-column: span 1;
  138. }
  139. }
  140.  
  141. &.mobile-columns-2 {
  142. grid-template-columns: repeat(2, 1fr);
  143. }
  144. }
  145. }
  146.  
  147. .grid-flex {
  148. display: flex;
  149. flex-wrap: wrap;
  150. margin-right: -15px;
  151. margin-bottom: -30px;
  152. margin-left: -15px;
  153.  
  154. > .grid-cell {
  155. padding-right: 15px;
  156. padding-bottom: 30px;
  157. padding-left: 15px;
  158.  
  159. :last-child {
  160. margin-bottom: 0;
  161. }
  162.  
  163. &.cell-flex {
  164. display: flex;
  165. }
  166.  
  167. &.horizontal-left {
  168. justify-self: start;
  169. }
  170.  
  171. &.horizontal-center {
  172. justify-self: center;
  173. }
  174.  
  175. &.horizontal-right {
  176. justify-self: end;
  177. }
  178.  
  179. &.vertical-top {
  180. align-self: start;
  181. }
  182.  
  183. &.vertical-center {
  184. align-self: center;
  185. }
  186.  
  187. &.vertical-bottom {
  188. align-self: end;
  189. }
  190. }
  191.  
  192. &.gap-small {
  193. margin-right: -10px;
  194. margin-bottom: -20px;
  195. margin-left: -10px;
  196.  
  197. > .grid-cell {
  198. padding-right: 10px;
  199. padding-bottom: 20px;
  200. padding-left: 10px;
  201. }
  202. }
  203.  
  204. &.gap-large {
  205. margin-right: -30px;
  206. margin-bottom: -60px;
  207. margin-left: -30px;
  208.  
  209. > .grid-cell {
  210. padding-right: 30px;
  211. padding-bottom: 60px;
  212. padding-left: 30px;
  213. }
  214. }
  215.  
  216. &.gap-huge {
  217. margin-right: -40px;
  218. margin-bottom: -80px;
  219. margin-left: -40px;
  220.  
  221. > .grid-cell {
  222. padding-right: 40px;
  223. padding-bottom: 80px;
  224. padding-left: 40px;
  225. }
  226. }
  227.  
  228. &.no-overflow {
  229. &, &.gap-small, &.gap-large, &.gap-huge {
  230. margin-right: 0;
  231. margin-left: 0;
  232. }
  233. }
  234.  
  235. &.horizontal-left {
  236. justify-content: flex-start;
  237. }
  238.  
  239. &.horizontal-center {
  240. justify-content: center;
  241. }
  242.  
  243. &.horizontal-right {
  244. justify-content: flex-end;
  245. }
  246.  
  247. &.vertical-top {
  248. align-content: flex-start;
  249. }
  250.  
  251. &.vertical-center {
  252. align-content: center;
  253. }
  254.  
  255. &.vertical-bottom {
  256. align-content: flex-end;
  257. }
  258.  
  259. &.vertical-items-top {
  260. align-items: flex-start;
  261. }
  262.  
  263. &.vertical-items-center {
  264. align-items: center;
  265. }
  266.  
  267. &.vertical-items-bottom {
  268. align-items: flex-end;
  269. }
  270.  
  271. @for $i from 1 to 12 {
  272. &.columns-$i > .grid-cell {
  273. width: calc(100% / $i);
  274. }
  275. }
  276.  
  277. @for $i from 1 to 12 {
  278. > .span-$i {
  279. width: calc(100% / (12 / $i));
  280. }
  281. }
  282.  
  283. @media <=map(bp, mobile) {
  284. &.mobile-columns-1 > .grid-cell {
  285. width: calc(100% / 1);
  286. }
  287.  
  288. &.mobile-columns-2 > .grid-cell {
  289. width: calc(100% / 2);
  290. }
  291. }
  292. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement