grip-grid-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 86033e6c6d93c47f20bcef4c056ff9a0a951a284
4
+ data.tar.gz: 84830ce18d2342f78e4850762ebdabe01e7ac024
5
+ SHA512:
6
+ metadata.gz: 139e68e68e8d92b04033220ae62506d5bb9d01c5161d366e1f6b3d35fe9eaa2ddc5a1eade0ab9b70057b6f3f53476658a77a857314575bef1b7afa4d437bb012
7
+ data.tar.gz: 1b12a78cec198b486699cab6d3f6cf332a6afdb2823ee015b3994e8af4fac4f8a7e43c65633c23a37f48c4b841c46fb989b2f0a519a33eb70a60c7a6a0523f6f
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Curt Howard, Tom Hare
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ # grip-grid-rails
2
+
3
+ [Grip](https://github.com/meowsus/grip), written by [Curt Howard](https://github.com/meowsus) and [Tom Hare](https://github.com/colourgarden), packaged for the Rails asset pipeline.
4
+
5
+ ## Usage
6
+
7
+ Add the following to your `Gemfile`:
8
+
9
+ ```
10
+ gem 'grip-grid-rails'
11
+ ```
12
+
13
+ All the following to your stylesheets manifest:
14
+
15
+ ```
16
+ @import 'grip';
17
+ ```
18
+
19
+ ## Disclaimer
20
+
21
+ This repo is a Rails gem package. All issues with the library should be reported on the library's [GitHub page](https://github.com/meowsus/grip). This repo will be updated each time a new version of the library is released.
@@ -0,0 +1,8 @@
1
+ require 'grip-grid-rails/version'
2
+
3
+ module GripGridRails
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module GripGridRails
2
+ module Rails
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,323 @@
1
+ /*! Grip | MIT License | @colourgarden & @meowsus// */
2
+
3
+ ////////////////////////////////////////
4
+ // #SETTINGS
5
+ ////////////////////////////////////////
6
+
7
+ //
8
+ // 1. prefix namespace for grid layout and cells
9
+ // 2. the gutter applied to grid cells
10
+ // 3. width class naming style. Options include `fraction`, `percentage` or
11
+ // `fragment`
12
+ // 4. width denominator values. Modify as needed. 2 = 1/2, 3 = 1/3, 2/3, etc.
13
+ // 5. enables permutation of all width classes with appended responsive modifier
14
+ // suffixes
15
+ // 6. responsive breakpoints. Modify as needed.
16
+ //
17
+ $grip-namespace: 'grid' !default; // [1]
18
+ $grip-gutter: 20px !default; // [2]
19
+
20
+ $grip-width-class-style: 'fraction' !default; // [3]
21
+ $grip-widths: (2, 3, 4) !default; // [4]
22
+
23
+ $grip-enable-responsive: true !default; // [5]
24
+ $grip-breakpoints: (
25
+ "medium": "screen and (min-width: 760px)",
26
+ "wide": "screen and (min-width: 960px)",
27
+ "x-wide": "screen and (min-width: 1160px)",
28
+ ) !default; // [6]
29
+
30
+
31
+ //
32
+ // Toggleable grid layout modifiers.
33
+ //
34
+ $grip-enable-grid-center: false !default;
35
+ $grip-enable-grid-right: false !default;
36
+ $grip-enable-grid-middle: false !default;
37
+ $grip-enable-grid-bottom: false !default;
38
+ $grip-enable-grid-flush: false !default;
39
+ $grip-enable-grid-tiny: false !default;
40
+ $grip-enable-grid-small: false !default;
41
+ $grip-enable-grid-large: false !default;
42
+ $grip-enable-grid-huge: false !default;
43
+ $grip-enable-grid-auto: false !default;
44
+ $grip-enable-grid-rev: false !default;
45
+
46
+
47
+ //
48
+ // Toggleable grid cell layout modifiers.
49
+ //
50
+ $grip-enable-grid-cell-center: false !default;
51
+
52
+
53
+
54
+
55
+
56
+ ////////////////////////////////////////
57
+ // #FUNCTIONS
58
+ ////////////////////////////////////////
59
+ //
60
+ // Responsible for constructing the grid cell class name. Returns Strings like:
61
+ // `grid__cell--16` or `grid__cell--16-at-medium`.
62
+ //
63
+ // 1. sets the width delimiter
64
+ // 2. sets the class name to `grid__cell--1/6` or `grid__cell--1-of-6`
65
+ // 3. sets the class name to `grid__cell--16` which is the percentage, floored
66
+ //
67
+ @function grip-create-class-name($style, $numerator, $denominator, $breakpoint-alias) {
68
+ $class-name: null;
69
+
70
+ @if ($style == 'fraction' or $style == 'fragment') {
71
+ $delimiter: if($style == 'fraction', \/, -of-); // [1]
72
+ $class-name: "#{$grip-namespace}__cell--#{$numerator}#{$delimiter}#{$denominator}#{$breakpoint-alias}"; // [2]
73
+ }
74
+ @else {
75
+ $class-width: floor(($numerator / $denominator) * 100);
76
+ $class-name: "#{$grip-namespace}__cell--#{$class-width}#{$breakpoint-alias}"; // [3]
77
+ }
78
+
79
+ @return $class-name;
80
+ }
81
+
82
+
83
+
84
+
85
+
86
+ ////////////////////////////////////////
87
+ // #MIXINS
88
+ ////////////////////////////////////////
89
+ //
90
+ // Responsible for outputting the final list of width modifiers.
91
+ //
92
+ // 1. create a scoped, temporary map of width data. Used to ensure there is no
93
+ // class duplication
94
+ // 2. handle the use case of someone using a `1` in the `$grid-widths` map
95
+ // 3. loop widths as fractions
96
+ // 4. determine if this width data is already accounted for in the temporary map
97
+ // 5. add the new entry to the temporary map
98
+ //
99
+ @mixin grip-create-widths($widths, $breakpoint-alias: null) {
100
+ $pseudo-class-map: (); // [1]
101
+
102
+ @each $denominator in $widths {
103
+ @if ($denominator == 1) { // [2]
104
+ $class-name: grip-create-class-name($grip-width-class-style, 1, 1, $breakpoint-alias);
105
+
106
+ .#{$class-name} {
107
+ width: 100%;
108
+ }
109
+ }
110
+ @else {
111
+ @for $numerator from 1 to $denominator { // [3]
112
+ $class-name: grip-create-class-name($grip-width-class-style, $numerator, $denominator, $breakpoint-alias);
113
+ $width-value: percentage($numerator / $denominator);
114
+
115
+ $duplicate: map-get($pseudo-class-map, $width-value); // [4]
116
+ @if ($duplicate == null) {
117
+ .#{$class-name} {
118
+ width: $width-value;
119
+ }
120
+
121
+ $add-class: ($width-value: $class-name);
122
+ $pseudo-class-map: map-merge($pseudo-class-map, $add-class); // [5]
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+
129
+
130
+ ////////////////////////////////////////
131
+ // #RESPOND-TO-MIXIN
132
+ ////////////////////////////////////////
133
+ //
134
+ // Provides a way to hook into the breakpoints defined in `$grip-breakpoints`.
135
+ //
136
+ // 1. search breakpoint for alias
137
+ // 2. if alias exists, print out media query
138
+ //
139
+ @mixin grip-respond-to($alias) {
140
+ $query: map-get($grip-breakpoints, $alias); // [1]
141
+
142
+ @if ($query) { // [2]
143
+ @media #{$query} {
144
+ @content;
145
+ }
146
+ }
147
+ @else{
148
+ @error "No breakpoint found for #{$alias}";
149
+ }
150
+ }
151
+
152
+
153
+
154
+
155
+
156
+ ////////////////////////////////////////
157
+ // #GRID-LAYOUT
158
+ ////////////////////////////////////////
159
+
160
+ .#{$grip-namespace} {
161
+ display: block;
162
+ margin: 0;
163
+ margin-left: -($grip-gutter);
164
+ padding: 0;
165
+ font-size: 0;
166
+ list-style: none;
167
+ }
168
+
169
+ .#{$grip-namespace}__cell {
170
+ display: inline-block;
171
+ margin: 0;
172
+ padding: 0;
173
+ padding-left: $grip-gutter;
174
+ width: 100%;
175
+ font-size: 1rem;
176
+ vertical-align: top;
177
+ box-sizing: border-box;
178
+ }
179
+
180
+
181
+
182
+
183
+
184
+ ////////////////////////////////////////
185
+ // #TOGGLEABLE-GRID-LAYOUT-MODIFIERS
186
+ ////////////////////////////////////////
187
+
188
+ @if ($grip-enable-grid-center) {
189
+ .#{$grip-namespace}--center {
190
+ text-align: center;
191
+
192
+ > .#{$grip-namespace}__cell {
193
+ text-align: left;
194
+ }
195
+ }
196
+ }
197
+
198
+ @if ($grip-enable-grid-right) {
199
+ .#{$grip-namespace}--right {
200
+ text-align: right;
201
+
202
+ > .#{$grip-namespace}__cell {
203
+ text-align: left;
204
+ }
205
+ }
206
+ }
207
+
208
+ @if ($grip-enable-grid-middle) {
209
+ .#{$grip-namespace}--middle {
210
+ > .#{$grip-namespace}__cell {
211
+ vertical-align: middle;
212
+ }
213
+ }
214
+ }
215
+
216
+ @if ($grip-enable-grid-bottom) {
217
+ .#{$grip-namespace}--bottom {
218
+ > .#{$grip-namespace}__cell {
219
+ vertical-align: bottom;
220
+ }
221
+ }
222
+ }
223
+
224
+ @if ($grip-enable-grid-flush) {
225
+ .#{$grip-namespace}--flush {
226
+ margin-left: 0;
227
+
228
+ > .#{$grip-namespace}__cell {
229
+ padding-left: 0;
230
+ }
231
+ }
232
+ }
233
+
234
+ @if ($grip-enable-grid-tiny) {
235
+ .#{$grip-namespace}--tiny {
236
+ margin-left: -($grip-gutter / 4);
237
+
238
+ > .#{$grip-namespace}__cell {
239
+ padding-left: ($grip-gutter / 4);
240
+ }
241
+ }
242
+ }
243
+
244
+ @if ($grip-enable-grid-small) {
245
+ .#{$grip-namespace}--small {
246
+ margin-left: -($grip-gutter / 2);
247
+
248
+ > .#{$grip-namespace}__cell {
249
+ padding-left: ($grip-gutter / 2);
250
+ }
251
+ }
252
+ }
253
+
254
+ @if ($grip-enable-grid-large) {
255
+ .#{$grip-namespace}--large {
256
+ margin-left: -($grip-gutter * 2);
257
+
258
+ > .#{$grip-namespace}__cell {
259
+ padding-left: ($grip-gutter * 2);
260
+ }
261
+ }
262
+ }
263
+
264
+ @if ($grip-enable-grid-huge) {
265
+ .#{$grip-namespace}--huge {
266
+ margin-left: -($grip-gutter * 4);
267
+
268
+ > .#{$grip-namespace}__cell {
269
+ padding-left: ($grip-gutter * 4);
270
+ }
271
+ }
272
+ }
273
+
274
+ @if ($grip-enable-grid-auto) {
275
+ .#{$grip-namespace}--auto {
276
+ > .#{$grip-namespace}__cell {
277
+ width: auto;
278
+ }
279
+ }
280
+ }
281
+
282
+ @if ($grip-enable-grid-rev) {
283
+ .#{$grip-namespace}--rev {
284
+ direction: rtl;
285
+
286
+ > .#{$grip-namespace}__cell {
287
+ direction: ltr;
288
+ }
289
+ }
290
+ }
291
+
292
+
293
+ ////////////////////////////////////////
294
+ // #TOGGLEABLE-GRID-CELL-MODIFIERS
295
+ ////////////////////////////////////////
296
+
297
+ @if ($grip-enable-grid-cell-center) {
298
+ .#{$grip-namespace}__cell--center {
299
+ display: block;
300
+ margin: 0 auto;
301
+ }
302
+ }
303
+
304
+
305
+
306
+
307
+
308
+ ////////////////////////////////////////
309
+ // #GRID-WIDTHS
310
+ ////////////////////////////////////////
311
+ //
312
+ // 1. output default width modifiers
313
+ // 2. if responsive flag is enabled, add responsive width modifiers
314
+ //
315
+ @include grip-create-widths($grip-widths); // [1]
316
+
317
+ @if $grip-enable-responsive { // [2]
318
+ @each $alias, $query in $grip-breakpoints {
319
+ @media #{$query} {
320
+ @include grip-create-widths($grip-widths, -for-#{$alias});
321
+ }
322
+ }
323
+ }
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grip-grid-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Curt Howard
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A build of the Grip CSS grid system, written by written by Curt Howard,
14
+ packaged for the Rails asset pipeline.
15
+ email:
16
+ - curt@meows.us
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE
22
+ - README.md
23
+ - lib/grip-grid-rails.rb
24
+ - lib/grip-grid-rails/version.rb
25
+ - vendor/assets/stylesheets/_grip.scss
26
+ homepage: https://github.com/meowsus/grip-grid-rails
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.5.1
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: A build of the Grip CSS grid system, written by written by Curt Howard, packaged
50
+ for the Rails asset pipeline.
51
+ test_files: []