codelation_assets 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ca3c992927b6e2d6064b7cd25b3c1928e5f83af
4
- data.tar.gz: 19c3ca3bae112da86dfbc5b653f0c94537631dca
3
+ metadata.gz: e93bec66b6bcb13f4f656cccd2072dfb242ca3e9
4
+ data.tar.gz: 3476ce2acb72606b646f38479026b36de2fd1518
5
5
  SHA512:
6
- metadata.gz: 80bfdb64805b7d831f07e5a7c5b89613423f6d2e02d876aed4ac53bd0bf50b458f735c62a8b2d16ac9c5992aa2c0f04af30191d8c218f20f5959f82a800d8647
7
- data.tar.gz: 3726a2faa1f0d4dea5294704e5299297d86cc38c8e323bce81b8c19f2bb0d3b3910fc84477647b7bf5f9e1914cb7b1ce16309ab35e532966874de1bd80e081bc
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 should be a single row with a known number of child
204
- elements. Use `has-grid` if there is an unknown number of child elements.
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 layout with three columns.
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(wrap);
9
- @include justify-content(space-around);
8
+ @include flex-wrap(nowrap);
9
+ @include justify-content(flex-start);
10
10
 
11
11
  > * {
12
- @include flex(1 1 auto);
12
+ @if $grow {
13
+ @include flex(1 1 auto);
14
+ }
13
15
 
14
- @if $gutter == 0 {
15
- // If there is no gutter, we don't need to do anything other
16
- // than split up the columns evenly.
17
- width: 100% / $columns;
18
- } @else if unit($gutter) == "px" or unit($gutter) == "em" {
19
- // If there is a fixed gutter size, we need to trick the columns into
20
- // being close to the right width and stretching to fill in the rest.
21
- width: 85% / $columns;
22
- } @else if unit($gutter) == "%" {
23
- // If the gutter size is a percentage of the width, we can use the percentage
24
- // to calculate the width of the columns as a percentage as well.
25
- width: (100% - ($gutter * ($columns - 1))) / $columns;
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;
@@ -1,3 +1,3 @@
1
1
  module CodelationAssets
2
- VERSION = "0.3.4".freeze
2
+ VERSION = "0.3.5".freeze
3
3
  end
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
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-02-16 00:00:00.000000000 Z
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: