codelation_assets 0.0.1
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 +7 -0
- data/LICENSE +20 -0
- data/README.md +39 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/codelation/app.js +52 -0
- data/app/assets/javascripts/codelation/components/columns.js +15 -0
- data/app/assets/javascripts/codelation.js +1 -0
- data/app/assets/stylesheets/codelation/functions/color.scss +162 -0
- data/app/assets/stylesheets/codelation/functions/text-color.scss +41 -0
- data/app/assets/stylesheets/codelation/mixins/button.scss +34 -0
- data/app/assets/stylesheets/codelation/mixins/center_children.scss +9 -0
- data/app/assets/stylesheets/codelation/mixins/has_cards.scss +36 -0
- data/app/assets/stylesheets/codelation/mixins/has_columns.scss +51 -0
- data/app/assets/stylesheets/codelation.scss +5 -0
- data/lib/codelation_assets/version.rb +3 -0
- data/lib/codelation_assets.rb +7 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6549536b415b4fc11505c21b5672e6379a3ff7a
|
4
|
+
data.tar.gz: e82ea463c05fd0c5e333aa5ab2b01c391c751df2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 817863835f95d6c9d6a7626d2200fb8fbe22fc6b43209d9f01abf06062ae54e35437a09a2c4bbe1d45edcb01b357b1eaeadf52c490582ee2b544ff0d2949a6b4
|
7
|
+
data.tar.gz: 1b7e396bb393cbe7bd5ed06ed771b42af2de12caf0edb7e6c5315d6920c108695a6407b566244577e206c94fa5d770e3b6647d3d431fdd61091bc4b42e13ea1c
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Brian Pattison
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Codelation Assets
|
2
|
+
|
3
|
+
A collection of SCSS mixins and JavaScript helpers used by Codelation for building awesome Rails apps quickly.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "codelation-assets"
|
11
|
+
```
|
12
|
+
|
13
|
+
Install the Codelation Assets gem with Bundler:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
**JavaScript**
|
22
|
+
|
23
|
+
```javascript
|
24
|
+
//= require codelation
|
25
|
+
```
|
26
|
+
|
27
|
+
**Sass**
|
28
|
+
|
29
|
+
```scss
|
30
|
+
@include "codelation";
|
31
|
+
```
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require "bundler/setup"
|
3
|
+
rescue LoadError
|
4
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
5
|
+
end
|
6
|
+
|
7
|
+
require "rdoc/task"
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = "rdoc"
|
11
|
+
rdoc.title = "Codelation Assets"
|
12
|
+
rdoc.options << "--line-numbers"
|
13
|
+
rdoc.rdoc_files.include("README.rdoc")
|
14
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load "rails/tasks/engine.rake"
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require "rake/testtask"
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << "lib"
|
28
|
+
t.libs << "test"
|
29
|
+
t.pattern = "test/**/*_test.rb"
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,52 @@
|
|
1
|
+
(function() {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var app = window.App;
|
5
|
+
|
6
|
+
if (app === undefined) {
|
7
|
+
app = window.App = {};
|
8
|
+
}
|
9
|
+
|
10
|
+
// Register functions to run when any page or specific pages are loaded.
|
11
|
+
//
|
12
|
+
// Example for running code only when `pages#home` loads:
|
13
|
+
//
|
14
|
+
// App.register('pages.home').enter(function() {
|
15
|
+
// // Set up
|
16
|
+
// }).exit(function() {
|
17
|
+
// // Tear down (Might be needed for Turbolinks)
|
18
|
+
// });
|
19
|
+
//
|
20
|
+
// Example for running code on every page load:
|
21
|
+
//
|
22
|
+
// App.register('component').enter(function() {
|
23
|
+
// // Set up
|
24
|
+
// }).exit(function() {
|
25
|
+
// // Tear down (Might be needed for Turbolinks)
|
26
|
+
// });
|
27
|
+
app.register = function(mixed) {
|
28
|
+
if (mixed === 'component') {
|
29
|
+
return appComponent();
|
30
|
+
} else {
|
31
|
+
return appController(mixed);
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
// Returns an object with `enter` and `exit` functions with for setting
|
36
|
+
// up and tearing down components pages specified by the controller/action.
|
37
|
+
function appController(controllerWithAction) {
|
38
|
+
var body = $('body');
|
39
|
+
var split = controllerWithAction.split('.');
|
40
|
+
var controller = split[0];
|
41
|
+
var action = split[1];
|
42
|
+
|
43
|
+
// enter: ready page:load
|
44
|
+
// exit: page:before-unload
|
45
|
+
}
|
46
|
+
|
47
|
+
// Returns an object with `enter` and `exit` functions with for setting
|
48
|
+
// up and tearing down components on each page load/change.
|
49
|
+
function appComponent() {
|
50
|
+
|
51
|
+
}
|
52
|
+
})();
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
var elementsWithColumns = $('body *').filter(function() {
|
3
|
+
return $(this).css('column-count') !== 'auto';
|
4
|
+
});
|
5
|
+
|
6
|
+
elementsWithColumns.each(function() {
|
7
|
+
var container = $(this);
|
8
|
+
var columns = container.css('column-count');
|
9
|
+
var children = container.children().length;
|
10
|
+
var missingColumns = columns - (children % columns);
|
11
|
+
for (var i = 0; i < missingColumns; i++) {
|
12
|
+
container.append('<span></span>');
|
13
|
+
}
|
14
|
+
});
|
15
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree ./codelation
|
@@ -0,0 +1,162 @@
|
|
1
|
+
// Google's material design colors
|
2
|
+
// @see https://www.google.com/design/spec/style/color.html
|
3
|
+
$amber: #ffc107;
|
4
|
+
$black: #000;
|
5
|
+
$blue: #2196f3;
|
6
|
+
$blue-grey: #607d8b;
|
7
|
+
$brown: #795548;
|
8
|
+
$cyan: #00bcd4;
|
9
|
+
$deep-orange: #ff5722;
|
10
|
+
$deep-purple: #673ab7;
|
11
|
+
$green: #4caf50;
|
12
|
+
$grey: #9e9e9e;
|
13
|
+
$indigo: #3f51b5;
|
14
|
+
$light-blue: #03a9f4;
|
15
|
+
$light-green: #8bc34a;
|
16
|
+
$lime: #cddc39;
|
17
|
+
$orange: #ff9800;
|
18
|
+
$pink: #e91e63;
|
19
|
+
$purple: #9c27b0;
|
20
|
+
$red: #f44336;
|
21
|
+
$teal: #009688;
|
22
|
+
$white: #fff;
|
23
|
+
$yellow: #ffeb3b;
|
24
|
+
|
25
|
+
$amber-colors: #fff8e1, #ffecb3, #ffe082, #ffd54f, #ffca28, #ffc107, #ffb300, #ffa000, #ff8f00, #ff6f00, #ffe57f, #ffd740, #ffc400, #ffab00;
|
26
|
+
$blue-colors: #e3f2fd, #bbdefb, #90caf9, #64b5f6, #42a5f5, #2196f3, #1e88e5, #1976d2, #1565c0, #0d47a1, #82b1ff, #448aff, #2979ff, #2962ff;
|
27
|
+
$blue-grey-colors: #eceff1, #cfd8dc, #b0bec5, #90a4ae, #78909c, #607d8b, #546e7a, #455a64, #37474f, #263238;
|
28
|
+
$brown-colors: #efebe9, #d7ccc8, #bcaaa4, #a1887f, #8d6e63, #795548, #6d4c41, #5d4037, #4e342e, #3e2723;
|
29
|
+
$cyan-colors: #e0f7fa, #b2ebf2, #80deea, #4dd0e1, #26c6da, #00bcd4, #00acc1, #0097a7, #00838f, #006064, #84ffff, #18ffff, #00e5ff, #00b8d4;
|
30
|
+
$deep-orange-colors: #fbe9e7, #ffccbc, #ffab91, #ff8a65, #ff7043, #ff5722, #f4511e, #e64a19, #d84315, #bf360c, #ff9e80, #ff6e40, #ff3d00, #dd2c00;
|
31
|
+
$deep-purple-colors: #ede7f6, #d1c4e9, #b39ddb, #9575cd, #7e57c2, #673ab7, #5e35b1, #512da8, #4527a0, #311b92, #b388ff, #7c4dff, #651fff, #6200ea;
|
32
|
+
$green-colors: #e8f5e9, #c8e6c9, #a5d6a7, #81c784, #66bb6a, #4caf50, #43a047, #388e3c, #2e7d32, #1b5e20, #b9f6ca, #69f0ae, #00e676, #00c853;
|
33
|
+
$grey-colors: #fafafa, #f5f5f5, #eeeeee, #e0e0e0, #bdbdbd, #9e9e9e, #757575, #616161, #424242, #212121;
|
34
|
+
$indigo-colors: #e8eaf6, #c5cae9, #9fa8da, #7986cb, #5c6bc0, #3f51b5, #3949ab, #303f9f, #283593, #1a237e, #8c9eff, #536dfe, #3d5afe, #304ffe;
|
35
|
+
$light-blue-colors: #e1f5fe, #b3e5fc, #81d4fa, #4fc3f7, #29b6f6, #03a9f4, #039be5, #0288d1, #0277bd, #01579b, #80d8ff, #40c4ff, #00b0ff, #0091ea;
|
36
|
+
$light-green-colors: #f1f8e9, #dcedc8, #c5e1a5, #aed581, #9ccc65, #8bc34a, #7cb342, #689f38, #558b2f, #33691e, #ccff90, #b2ff59, #76ff03, #64dd17;
|
37
|
+
$lime-colors: #f9fbe7, #f0f4c3, #e6ee9c, #dce775, #d4e157, #cddc39, #c0ca33, #afb42b, #9e9d24, #827717, #f4ff81, #eeff41, #c6ff00, #aeea00;
|
38
|
+
$orange-colors: #fff3e0, #ffe0b2, #ffcc80, #ffb74d, #ffa726, #ff9800, #fb8c00, #f57c00, #ef6c00, #e65100, #ffd180, #ffab40, #ff9100, #ff6d00;
|
39
|
+
$pink-colors: #fce4ec, #f8bbd0, #f48fb1, #f06292, #ec407a, #e91e63, #d81b60, #c2185b, #ad1457, #880e4f, #ff80ab, #ff4081, #f50057, #c51162;
|
40
|
+
$purple-colors: #f3e5f5, #e1bee7, #ce93d8, #ba68c8, #ab47bc, #9c27b0, #8e24aa, #7b1fa2, #6a1b9a, #4a148c, #ea80fc, #e040fb, #d500f9, #aa00ff;
|
41
|
+
$red-colors: #ffebee, #ffcdd2, #ef9a9a, #e57373, #ef5350, #f44336, #e53935, #d32f2f, #c62828, #b71c1c, #ff8a80, #ff5252, #ff1744, #d50000;
|
42
|
+
$teal-colors: #e0f2f1, #b2dfdb, #80cbc4, #4db6ac, #26a69a, #009688, #00897b, #00796b, #00695c, #004d40, #a7ffeb, #64ffda, #1de9b6, #00bfa5;
|
43
|
+
$yellow-colors: #fffde7, #fff9c4, #fff59d, #fff176, #ffee58, #ffeb3b, #fdd835, #fbc02d, #f9a825, #f57f17, #ffff8d, #ffff00, #ffea00, #ffd600;
|
44
|
+
|
45
|
+
@function color($color, $number: 500) {
|
46
|
+
$colors: "custom";
|
47
|
+
$index: 6;
|
48
|
+
|
49
|
+
@if $color == $amber {
|
50
|
+
$colors: $amber-colors;
|
51
|
+
} @else if $color == $black {
|
52
|
+
@return $black;
|
53
|
+
} @else if $color == $blue {
|
54
|
+
$colors: $blue-colors;
|
55
|
+
} @else if $color == $blue-grey {
|
56
|
+
$colors: $blue-grey-colors;
|
57
|
+
} @else if $color == $brown {
|
58
|
+
$colors: $brown-colors;
|
59
|
+
} @else if $color == $cyan {
|
60
|
+
$colors: $cyan-colors;
|
61
|
+
} @else if $color == $deep-orange {
|
62
|
+
$colors: $deep-orange-colors;
|
63
|
+
} @else if $color == $deep-purple {
|
64
|
+
$colors: $deep-purple-colors;
|
65
|
+
} @else if $color == $green {
|
66
|
+
$colors: $green-colors;
|
67
|
+
} @else if $color == $grey {
|
68
|
+
$colors: $grey-colors;
|
69
|
+
} @else if $color == $indigo {
|
70
|
+
$colors: $indigo-colors;
|
71
|
+
} @else if $color == $light-blue {
|
72
|
+
$colors: $light-blue-colors;
|
73
|
+
} @else if $color == $light-green {
|
74
|
+
$colors: $light-green-colors;
|
75
|
+
} @else if $color == $green {
|
76
|
+
$colors: $green-colors;
|
77
|
+
} @else if $color == $lime {
|
78
|
+
$colors: $lime-colors;
|
79
|
+
} @else if $color == $orange {
|
80
|
+
$colors: $orange-colors;
|
81
|
+
} @else if $color == $pink {
|
82
|
+
$colors: $pink-colors;
|
83
|
+
} @else if $color == $purple {
|
84
|
+
$colors: $purple-colors;
|
85
|
+
} @else if $color == $red {
|
86
|
+
$colors: $red-colors;
|
87
|
+
} @else if $color == $teal {
|
88
|
+
$colors: $teal-colors;
|
89
|
+
} @else if $color == $white {
|
90
|
+
@return $white;
|
91
|
+
} @else if $color == $yellow {
|
92
|
+
$colors: $yellow-colors;
|
93
|
+
}
|
94
|
+
|
95
|
+
// A non-Material Design color was given, so we'll do our best to return a
|
96
|
+
// similar shade of that color. Will not handle the A100-A700 numbers.
|
97
|
+
@if $colors == "custom" {
|
98
|
+
@if $number == 50 {
|
99
|
+
@return desaturate(lighten($color, 38%), 25%);
|
100
|
+
} @else if $number == 100 {
|
101
|
+
@return desaturate(lighten($color, 28%), 16%);
|
102
|
+
} @else if $number == 200 {
|
103
|
+
@return desaturate(lighten($color, 22%), 10%);
|
104
|
+
} @else if $number == 300 {
|
105
|
+
@return desaturate(lighten($color, 15%), 8%);
|
106
|
+
} @else if $number == 400 {
|
107
|
+
@return desaturate(lighten($color, 8%), 2%);
|
108
|
+
} @else if $number == 500 {
|
109
|
+
@return $color;
|
110
|
+
} @else if $number == 600 {
|
111
|
+
@return desaturate(darken($color, 5%), 10%);
|
112
|
+
} @else if $number == 700 {
|
113
|
+
@return desaturate(darken($color, 10%), 18%);
|
114
|
+
} @else if $number == 800 {
|
115
|
+
@return desaturate(darken($color, 16%), 16%);
|
116
|
+
} @else if $number == 900 {
|
117
|
+
@return saturate(darken($color, 35%), 20%);
|
118
|
+
} @else {
|
119
|
+
@error "Only Google Material Design colors can be used with A100-A700. Given: #{$color} #{$number}";
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
// Google Material Design colors will return the exact color defined by Google.
|
124
|
+
@if $number == 50 {
|
125
|
+
$index: 1;
|
126
|
+
} @else if $number == 100 {
|
127
|
+
$index: 2;
|
128
|
+
} @else if $number == 200 {
|
129
|
+
$index: 3;
|
130
|
+
} @else if $number == 300 {
|
131
|
+
$index: 4;
|
132
|
+
} @else if $number == 400 {
|
133
|
+
$index: 5;
|
134
|
+
} @else if $number == 500 {
|
135
|
+
$index: 6;
|
136
|
+
} @else if $number == 600 {
|
137
|
+
$index: 7;
|
138
|
+
} @else if $number == 700 {
|
139
|
+
$index: 8;
|
140
|
+
} @else if $number == 800 {
|
141
|
+
$index: 9;
|
142
|
+
} @else if $number == 900 {
|
143
|
+
$index: 10;
|
144
|
+
} @else {
|
145
|
+
// A100-A700 colors are available for most Google Material Design colors with a few exceptions.
|
146
|
+
@if $color != $blue-grey and $color != $brown and $color != $grey {
|
147
|
+
@if $number == A100 {
|
148
|
+
$index: 11;
|
149
|
+
} @else if $number == A200 {
|
150
|
+
$index: 12;
|
151
|
+
} @else if $number == A400 {
|
152
|
+
$index: 13;
|
153
|
+
} @else if $number == A700 {
|
154
|
+
$index: 14;
|
155
|
+
}
|
156
|
+
} @else {
|
157
|
+
@error "$blue-grey, $brown, and $grey do not have A100-A700 colors. Given: #{$number}";
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
@return nth($colors, $index);
|
162
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// Get the text color to go on top of Google's material design colors
|
2
|
+
// @see https://www.google.com/design/spec/style/color.html
|
3
|
+
@function text-color($color) {
|
4
|
+
$text-color: $white;
|
5
|
+
|
6
|
+
@if $color == $amber {
|
7
|
+
$text-color: $black;
|
8
|
+
} @else if $color == $black {
|
9
|
+
$text-color: $white;
|
10
|
+
} @else if $color == $cyan {
|
11
|
+
$text-color: $black;
|
12
|
+
} @else if $color == $deep-orange {
|
13
|
+
$text-color: $white;
|
14
|
+
} @else if $color == $green {
|
15
|
+
$text-color: $black;
|
16
|
+
} @else if $color == $grey {
|
17
|
+
$text-color: $black;
|
18
|
+
} @else if $color == $light-blue {
|
19
|
+
$text-color: $black;
|
20
|
+
} @else if $color == $light-green {
|
21
|
+
$text-color: $black;
|
22
|
+
} @else if $color == $green {
|
23
|
+
$text-color: $black;
|
24
|
+
} @else if $color == $lime {
|
25
|
+
$text-color: $black;
|
26
|
+
} @else if $color == $orange {
|
27
|
+
$text-color: $black;
|
28
|
+
} @else if $color == $white {
|
29
|
+
$text-color: $black;
|
30
|
+
} @else if $color == $yellow {
|
31
|
+
$text-color: $black;
|
32
|
+
} @else {
|
33
|
+
@if lightness($color) < 50% {
|
34
|
+
$text-color: $white;
|
35
|
+
} @else {
|
36
|
+
$text-color: $black;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
@return $text-color;
|
41
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
@mixin button($background-color: color($grey, 100), $font-color: $grey, $active-background-color: $accent-color, $active-font-color: text-color($accent-color)) {
|
2
|
+
background-image: linear-gradient(to bottom, $background-color, darken($background-color, 8%));
|
3
|
+
border: 0;
|
4
|
+
border-radius: 2px;
|
5
|
+
box-shadow: rgba(0, 0, 0, 0.14902) 0 0 0 1px inset;
|
6
|
+
color: $font-color;
|
7
|
+
display: inline-block;
|
8
|
+
font-size: 11px;
|
9
|
+
height: 26px;
|
10
|
+
line-height: 25px;
|
11
|
+
margin-bottom: 4px;
|
12
|
+
outline: none;
|
13
|
+
padding: 0 12px;
|
14
|
+
text-align: center;
|
15
|
+
text-decoration: none;
|
16
|
+
vertical-align: middle;
|
17
|
+
white-space: nowrap;
|
18
|
+
|
19
|
+
i {
|
20
|
+
font-size: 13px;
|
21
|
+
line-height: 11px;
|
22
|
+
margin-right: 2px;
|
23
|
+
}
|
24
|
+
|
25
|
+
&:hover {
|
26
|
+
background-image: linear-gradient(to bottom, lighten($background-color, 5%), darken($background-color, 3.5%));
|
27
|
+
color: $font-color;
|
28
|
+
}
|
29
|
+
|
30
|
+
&:active {
|
31
|
+
background-image: linear-gradient(to bottom, lighten($active-background-color, 3%), darken($active-background-color, 5%));
|
32
|
+
color: $active-font-color;
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// Centers child elements horizontally and vertically without needing
|
2
|
+
// to set the height and width of the child elements using flexbox.
|
3
|
+
@mixin center-children {
|
4
|
+
@include align-content(center);
|
5
|
+
@include align-items(center);
|
6
|
+
@include display(flex);
|
7
|
+
@include flex-direction(column);
|
8
|
+
@include justify-content(center);
|
9
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
// Sets up a element and its child elements with the flexbox properties needed
|
2
|
+
// to have the given number of columns with optional gutters or margins.
|
3
|
+
$mobile-breakpoint: 768px !default;
|
4
|
+
|
5
|
+
@mixin has-cards($columns, $margin: 0) {
|
6
|
+
@include align-content(flex-start);
|
7
|
+
@include align-items(stretch);
|
8
|
+
@include display(flex);
|
9
|
+
@include flex-direction(row);
|
10
|
+
@include flex-wrap(wrap);
|
11
|
+
@include justify-content(space-around);
|
12
|
+
column-count: $columns; // Used as a reference for JavaScript functions
|
13
|
+
padding: $margin 0 0 $margin;
|
14
|
+
|
15
|
+
> * {
|
16
|
+
@include flex(1 1 auto);
|
17
|
+
margin: 0 $margin $margin 0;
|
18
|
+
width: (1 / $columns) * 85%;
|
19
|
+
|
20
|
+
&:empty {
|
21
|
+
margin-bottom: 0;
|
22
|
+
margin-top: 0;
|
23
|
+
visibility: hidden;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
@media (max-width: $mobile-breakpoint) {
|
28
|
+
> * {
|
29
|
+
width: 100%;
|
30
|
+
|
31
|
+
&:empty {
|
32
|
+
display: none;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// Sets up a element and its child elements with the flexbox properties needed
|
2
|
+
// to have the given number of columns with an optional gutter value.
|
3
|
+
$mobile-breakpoint: 768px !default;
|
4
|
+
|
5
|
+
@mixin has-columns($columns, $gutter: 0) {
|
6
|
+
@include align-content(stretch);
|
7
|
+
@include align-items(stretch);
|
8
|
+
@include display(flex);
|
9
|
+
@include flex-direction(row);
|
10
|
+
@include flex-wrap(wrap);
|
11
|
+
@include justify-content(space-around);
|
12
|
+
column-count: $columns; // Used as a reference for JavaScript functions
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
|
16
|
+
> * {
|
17
|
+
@include flex(1 1 auto);
|
18
|
+
margin: 0;
|
19
|
+
width: (1 / $columns) * 85%;
|
20
|
+
|
21
|
+
@if $gutter > 0 {
|
22
|
+
margin-right: $gutter;
|
23
|
+
|
24
|
+
&:nth-child(#{$columns}n) {
|
25
|
+
margin-right: 0;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
&:empty {
|
30
|
+
margin-bottom: 0;
|
31
|
+
margin-top: 0;
|
32
|
+
visibility: hidden;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
@media (max-width: $mobile-breakpoint) {
|
37
|
+
> * {
|
38
|
+
margin-bottom: $gutter;
|
39
|
+
margin-right: 0;
|
40
|
+
width: 100%;
|
41
|
+
|
42
|
+
&:last-of-type {
|
43
|
+
margin-bottom: 0;
|
44
|
+
}
|
45
|
+
|
46
|
+
&:empty {
|
47
|
+
display: none;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: codelation_assets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Pattison
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A collection of Sass mixins and JavaScript helpers used by Codelation
|
42
|
+
for building awesome Rails apps quickly.
|
43
|
+
email:
|
44
|
+
- brian@brianpattison.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- app/assets/javascripts/codelation.js
|
53
|
+
- app/assets/javascripts/codelation/app.js
|
54
|
+
- app/assets/javascripts/codelation/components/columns.js
|
55
|
+
- app/assets/stylesheets/codelation.scss
|
56
|
+
- app/assets/stylesheets/codelation/functions/color.scss
|
57
|
+
- app/assets/stylesheets/codelation/functions/text-color.scss
|
58
|
+
- app/assets/stylesheets/codelation/mixins/button.scss
|
59
|
+
- app/assets/stylesheets/codelation/mixins/center_children.scss
|
60
|
+
- app/assets/stylesheets/codelation/mixins/has_cards.scss
|
61
|
+
- app/assets/stylesheets/codelation/mixins/has_columns.scss
|
62
|
+
- lib/codelation_assets.rb
|
63
|
+
- lib/codelation_assets/version.rb
|
64
|
+
homepage: https://github.com/codelation/codelation_assets
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.5.1
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: A collection of Sass mixins and JavaScript helpers.
|
88
|
+
test_files: []
|