codelation_assets 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -4
- data/app/assets/stylesheets/codelation/mixins/has_columns.scss +24 -16
- data/lib/codelation_assets/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e93bec66b6bcb13f4f656cccd2072dfb242ca3e9
|
4
|
+
data.tar.gz: 3476ce2acb72606b646f38479026b36de2fd1518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e73952871559aa7db17f2926787ffcb38bd356ee9680b19c44afc1531b4a2ff6f3f3be38b234d6e840c37db55b89949c016bdc6b9e71bb739e32d0034bd9db82
|
7
|
+
data.tar.gz: c59beab4ab272892e9f66724b477f40966cf65edaa7e33e5ea145fb1eaf8cc27c1a709564992506827e23d54da389aef034ad71e7379c6b49b3c1f4daecff1a6
|
data/README.md
CHANGED
@@ -196,12 +196,16 @@ Example:
|
|
196
196
|
}
|
197
197
|
```
|
198
198
|
|
199
|
-
##### has-columns($columns, $gutter: 0)
|
199
|
+
##### has-columns($columns: 0, $gutter: 0, $grow: true)
|
200
200
|
|
201
201
|
This mixin uses flexbox to create a layout with the specified number of columns that
|
202
202
|
stretch to fill the container's height. The given gutter size will the margin between
|
203
|
-
the columns. The container
|
204
|
-
|
203
|
+
the columns. The container must be a single row of columns.
|
204
|
+
|
205
|
+
When the column count is given, the columns will all be the same width. If no column
|
206
|
+
count is given, the row will behave like a table row. The entire width will be used
|
207
|
+
and each column width will be determined by its content. `$grow` can be set to false
|
208
|
+
if you don't want the columns to take up the entire width of the container.
|
205
209
|
|
206
210
|
Example:
|
207
211
|
|
@@ -213,17 +217,33 @@ Example:
|
|
213
217
|
<div>Column 2<div>
|
214
218
|
<div>Column 3<div>
|
215
219
|
</div>
|
220
|
+
|
221
|
+
<div class="table">
|
222
|
+
<div>Column 1</div>
|
223
|
+
<div>Column 2</div>
|
224
|
+
<div>Column 3</div>
|
225
|
+
<div>Column 4</div>
|
226
|
+
<div>Column 5</div>
|
227
|
+
</div>
|
216
228
|
```
|
217
229
|
|
218
230
|
**SCSS**
|
219
231
|
|
220
232
|
```scss
|
221
|
-
// This will create a
|
233
|
+
// This will create a row with three columns.
|
222
234
|
// The columns will all fill the container height.
|
223
235
|
// There will be a fixed gutter of 12px between the columns.
|
224
236
|
.row {
|
225
237
|
@include has-columns(3, 12px);
|
226
238
|
}
|
239
|
+
|
240
|
+
// This will create a row with five columns.
|
241
|
+
// The columns will all fill the container height and width.
|
242
|
+
// The width of each column will be determined by its content.
|
243
|
+
// There will be a fixed gutter of 10px between the columns.
|
244
|
+
.table {
|
245
|
+
@include has-columns($gutter: 10px);
|
246
|
+
}
|
227
247
|
```
|
228
248
|
|
229
249
|
###### col-span($columns of $container-columns, $gutter: 0)
|
@@ -1,28 +1,34 @@
|
|
1
1
|
// Sets up a element and its child elements with the flexbox properties needed
|
2
2
|
// to have the given number of columns with an optional gutter value.
|
3
|
-
@mixin has-columns($columns, $gutter: 0) {
|
3
|
+
@mixin has-columns($columns: 0, $gutter: 0, $grow: true) {
|
4
4
|
@include align-content(stretch);
|
5
5
|
@include align-items(stretch);
|
6
6
|
@include display(flex);
|
7
7
|
@include flex-direction(row);
|
8
|
-
@include flex-wrap(
|
9
|
-
@include justify-content(
|
8
|
+
@include flex-wrap(nowrap);
|
9
|
+
@include justify-content(flex-start);
|
10
10
|
|
11
11
|
> * {
|
12
|
-
@
|
12
|
+
@if $grow {
|
13
|
+
@include flex(1 1 auto);
|
14
|
+
}
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
// We only want to set the column width if more than 1 column was specified
|
17
|
+
// and we're looking to fill the container's width.
|
18
|
+
@if $grow and $columns > 1 {
|
19
|
+
@if $gutter == 0 {
|
20
|
+
// If there is no gutter, we don't need to do anything
|
21
|
+
// other than split up the columns evenly.
|
22
|
+
width: 100% / $columns;
|
23
|
+
} @else if unit($gutter) == "px" or unit($gutter) == "em" {
|
24
|
+
// If there is a fixed gutter size, we need to trick the columns into
|
25
|
+
// being close to the right width and stretching to fill in the rest.
|
26
|
+
width: 85% / $columns;
|
27
|
+
} @else if unit($gutter) == "%" {
|
28
|
+
// If the gutter size is a percentage of the width, we can use the percentage
|
29
|
+
// to calculate the width of the columns as a percentage as well.
|
30
|
+
width: (100% - ($gutter * ($columns - 1))) / $columns;
|
31
|
+
}
|
26
32
|
}
|
27
33
|
|
28
34
|
@if $gutter > 0 {
|
@@ -37,6 +43,8 @@
|
|
37
43
|
|
38
44
|
// Stack columns when the mobile breakpoint is set
|
39
45
|
@media (max-width: $mobile-breakpoint) {
|
46
|
+
@include flex-wrap(wrap);
|
47
|
+
|
40
48
|
> * {
|
41
49
|
margin-bottom: $gutter;
|
42
50
|
margin-right: 0;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codelation_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Pattison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -182,3 +182,4 @@ signing_key:
|
|
182
182
|
specification_version: 4
|
183
183
|
summary: A collection of Sass mixins and JavaScript helpers.
|
184
184
|
test_files: []
|
185
|
+
has_rdoc:
|