source: css/mini/_layout.scss@ 5c9a606

Last change on this file since 5c9a606 was 5c9a606, checked in by w96k <w96k.ru@…>, on May 5, 2019 at 2:16:42 AM

Delete Hugo; Add basic haunt blog

  • Property mode set to 100644
File size: 8.8 KB
Line 
1/*
2 Definitions for the grid system, cards and containers.
3*/
4// The grid system uses the flexbox module, meaning it might be incompatible with certain browsers.
5$_include-parent-layout: true !default; // [Hidden] Flag for rows defining column layouts (`true`/`false`).
6$grid-column-count: 12 !default; // Number of columns in the grid (integer value only).
7$grid-container-name: 'container' !default; // Class name for the grid system container.
8$grid-row-name: 'row' !default; // Class name for the grid system rows.
9$grid-row-parent-layout-prefix:'cols' !default; // Class name prefix for the grid's row parents.
10$grid-column-prefix: 'col' !default; // Class name prefix for the grid's columns.
11$grid-column-offset-suffix: 'offset' !default; // Class name suffix for the grid's offsets.
12$grid-order-normal-suffix: 'normal' !default; // Class name suffix for grid columns with normal priority.
13$grid-order-first-suffix: 'first' !default; // Class name suffix for grid columns with highest priority.
14$grid-order-last-suffix: 'last' !default; // Class name suffix for grid columns with lowest priorty.
15$grid-small-prefix: 'sm' !default; // Small screen class prefix for grid.
16$grid-medium-prefix: 'md' !default; // Medium screen class prefix for grid.
17$grid-large-prefix: 'lg' !default; // Large screen class prefix for grid.
18$grid-medium-breakpoint: 768px !default; // Medium screen breakpoint for grid.
19$grid-large-breakpoint: 1280px !default; // Large screen breakpoint for grid.
20$card-name: 'card' !default; // Class name for the cards.
21$card-section-name: 'section' !default; // Class name for the cards' sections.
22$card-section-media-name: 'media' !default; // Class name for the cards' sections (media cotent).
23$card-normal-width: 320px !default; // Width for normal cards.
24$card-section-media-height: 200px !default; // Height for cards' media sections.
25$card-fore-color: #111 !default; // Text color for the cards.
26$card-back-color: #f8f8f8 !default; // Background color for the cards.
27$card-border-color: #ddd !default; // Border color for the cards.
28// CSS variable name definitions [exercise caution if modifying these]
29$card-fore-color-var: '--card-fore-color' !default;
30$card-back-color-var: '--card-back-color' !default;
31$card-border-color-var: '--card-border-color' !default;
32// == Uncomment below code if this module is used on its own ==
33//
34// $universal-margin: 0.5rem !default; // Universal margin for the most elements
35// $universal-padding: 0.5rem !default; // Universal padding for the most elements
36// $universal-border-radius: 0.125rem !default; // Universal border-radius for most elements
37// $universal-box-shadow: none !default; // Universal box-shadow for most elements
38// $universal-margin-var: '--universal-margin' !default;
39// $universal-padding-var: '--universal-padding' !default;
40// $universal-border-radius-var: '--universal-border-radius' !default;
41// $universal-box-shadow-var: '--universal-box-shadow' !default;
42// :root {
43// #{$universal-margin-var}: $universal-margin;
44// #{$universal-padding-var}: $universal-padding;
45// #{$universal-border-radius-var}: $universal-border-radius;
46// @if $universal-box-shadow != none {
47// #{$universal-box-shadow-var}: $universal-box-shadow;
48// }
49// }
50//
51// ============================================================
52// Check the `_layout_mixins.scss` file to find this module's mixins.
53@import 'layout_mixins';
54// Fluid grid system container definition.
55.#{$grid-container-name} {
56 margin: 0 auto;
57 padding: 0 calc(1.5 * var(#{$universal-padding-var}));
58}
59// Grid row definition.
60.#{$grid-row-name} {
61 box-sizing: border-box;
62 display: flex;
63 flex: 0 1 auto;
64 flex-flow: row wrap;
65}
66// Inline mixin, used to generate class definitions for each grid step.
67@mixin generate-grid-size ($size-prefix){
68 @if $_include-parent-layout {
69 .#{$grid-column-prefix}-#{$size-prefix},
70 [class^='#{$grid-column-prefix}-#{$size-prefix}-'],
71 [class^='#{$grid-column-prefix}-#{$size-prefix}-#{$grid-column-offset-suffix}-'],
72 .#{$grid-row-name}[class*='#{$grid-row-parent-layout-prefix}-#{$size-prefix}-'] > * {
73 box-sizing: border-box;
74 flex: 0 0 auto;
75 padding: 0 calc(var(#{$universal-padding-var}) / 2);
76 }
77 // Grid column specific definition for flexible column.
78 .#{$grid-column-prefix}-#{$size-prefix},
79 .#{$grid-row-name}.#{$grid-row-parent-layout-prefix}-#{$size-prefix} > * {
80 max-width: 100%;
81 flex-grow: 1;
82 flex-basis: 0;
83 }
84 }
85 @else {
86 // Grid column generic definitions.
87 .#{$grid-column-prefix}-#{$size-prefix},
88 [class^='#{$grid-column-prefix}-#{$size-prefix}-'],
89 [class^='#{$grid-column-prefix}-#{$size-prefix}-#{$grid-column-offset-suffix}-'] {
90 flex: 0 0 auto;
91 padding: 0 calc(var(#{$universal-padding-var}) / 2);
92 }
93 // Grid column specific definition for flexible column.
94 .#{$grid-column-prefix}-#{$size-prefix} {
95 max-width: 100%;
96 flex-grow: 1;
97 flex-basis: 0;
98 }
99 }
100 // Grid column specific definitions for predefined columns.
101 @for $i from 1 through $grid-column-count {
102 @if $_include-parent-layout {
103 .#{$grid-column-prefix}-#{$size-prefix}-#{$i},
104 .#{$grid-row-name}.#{$grid-row-parent-layout-prefix}-#{$size-prefix}-#{$i} > * {
105 max-width: #{($i * 100% / $grid-column-count)};
106 flex-basis: #{($i * 100% / $grid-column-count)};
107 }
108 }
109 @else {
110 .#{$grid-column-prefix}-#{$size-prefix}-#{$i} {
111 max-width: #{($i * 100% / $grid-column-count)};
112 flex-basis: #{($i * 100% / $grid-column-count)};
113 }
114 }
115 // Offest definitions.
116 .#{$grid-column-prefix}-#{$size-prefix}-#{$grid-column-offset-suffix}-#{($i - 1)} {
117 @if ($i - 1) == 0 {
118 margin-left: 0;
119 }
120 @else {
121 margin-left: #{(($i - 1) * 100% / $grid-column-count)};
122 }
123 }
124 }
125 // Reordering definitions.
126 .#{$grid-column-prefix}-#{$size-prefix}-#{$grid-order-normal-suffix} {
127 order: initial;
128 }
129 .#{$grid-column-prefix}-#{$size-prefix}-#{$grid-order-first-suffix} {
130 order: -999;
131 }
132 .#{$grid-column-prefix}-#{$size-prefix}-#{$grid-order-last-suffix} {
133 order: 999;
134 }
135}
136// Definitions for smaller screens.
137@include generate-grid-size($grid-small-prefix);
138// Definitions for medium screens.
139@media screen and (min-width: #{$grid-medium-breakpoint}){
140 @include generate-grid-size($grid-medium-prefix);
141}
142// Definitions for large screens.
143@media screen and (min-width: #{$grid-large-breakpoint}){
144 @include generate-grid-size($grid-large-prefix);
145}
146/* Card component CSS variable definitions */
147:root {
148 #{$card-back-color-var}: $card-back-color;
149 #{$card-fore-color-var}: $card-fore-color;
150 #{$card-border-color-var}: $card-border-color;
151}
152// Card styling
153.#{$card-name} {
154 // New syntax
155 display: flex;
156 flex-direction: column;
157 justify-content: space-between;
158 align-self: center;
159 position: relative;
160 width: 100%;
161 // Actual styling for the cards
162 background: var(#{$card-back-color-var});
163 color: var(#{$card-fore-color-var});
164 border: $__1px solid var(#{$card-border-color-var});
165 border-radius: var(#{$universal-border-radius-var});
166 margin: var(#{$universal-margin-var});
167 @if $universal-box-shadow != none {
168 box-shadow: var(#{$universal-box-shadow-var});
169 }
170 overflow: hidden; // Hide overflow from section borders
171 // Responsiveness (if the screen is larger than card, set max-width)
172 @media screen and (min-width: #{$card-normal-width}) {
173 max-width: $card-normal-width;
174 }
175 // Card sections
176 & > .#{$card-section-name} {
177 // Reapply background and foreground colors, so that mixins can be applied properly.
178 background: var(#{$card-back-color-var});
179 color: var(#{$card-fore-color-var});
180 box-sizing: border-box;
181 margin: 0;
182 border: 0; // Clean borders and radiuses for any element-based sections
183 border-radius: 0; // Clean borders and radiuses for any element-based sections
184 border-bottom: $__1px solid var(#{$card-border-color-var});
185 padding: var(#{$universal-padding-var});
186 width: 100%;
187 // Card media sections
188 &.#{$card-section-media-name} {
189 height: $card-section-media-height;
190 padding: 0;
191 -o-object-fit: cover;
192 object-fit: cover;
193 }
194 }
195 // Card sections - last
196 & > .#{$card-section-name}:last-child {
197 border-bottom: 0; // Clean the extra border for last section
198 }
199}
Note: See TracBrowser for help on using the repository browser.