sparrow-theme 0.1.1 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/_includes/footer.html +12 -0
- data/_includes/head.html +16 -0
- data/_includes/header.html +21 -0
- data/_includes/modules/card.html +8 -0
- data/_includes/modules/heroBanner.html +29 -0
- data/_includes/modules/heroSearch.html +11 -0
- data/_includes/modules/modal.html +13 -0
- data/_includes/modules/navSearch.html +12 -0
- data/_includes/modules/spinner.html +5 -0
- data/_includes/svg/icon-back.svg +3 -0
- data/_includes/svg/icon-chevron-left.svg +3 -0
- data/_includes/svg/icon-chevron-right.svg +3 -0
- data/_includes/svg/icon-close.svg +3 -0
- data/_includes/svg/icon-search.svg +3 -0
- data/_includes/svg/logo-smartsparrow.svg +7 -0
- data/_includes/typekit.html +13 -0
- data/_layouts/404.html +14 -0
- data/_layouts/compress.html +9 -0
- data/_layouts/default.html +18 -0
- data/_layouts/page.html +18 -0
- data/_layouts/post.html +5 -0
- data/_sass/sparrow-theme/base/_base.scss +226 -0
- data/_sass/sparrow-theme/base/_mixins.scss +25 -0
- data/_sass/sparrow-theme/base/_variables.scss +62 -0
- data/_sass/sparrow-theme/layout/_404.scss +49 -0
- data/_sass/sparrow-theme/layout/_catalog.scss +79 -0
- data/_sass/sparrow-theme/layout/_component.scss +289 -0
- data/_sass/sparrow-theme/layout/_footer.scss +81 -0
- data/_sass/sparrow-theme/layout/_header.scss +418 -0
- data/_sass/sparrow-theme/layout/_layout.scss +15 -0
- data/_sass/sparrow-theme/layout/_page.scss +70 -0
- data/_sass/sparrow-theme/modules/_actionPrompt.scss +33 -0
- data/_sass/sparrow-theme/modules/_button.scss +107 -0
- data/_sass/sparrow-theme/modules/_card.scss +93 -0
- data/_sass/sparrow-theme/modules/_carousel.scss +182 -0
- data/_sass/sparrow-theme/modules/_componentCard.scss +92 -0
- data/_sass/sparrow-theme/modules/_heroBanner.scss +230 -0
- data/_sass/sparrow-theme/modules/_modal.scss +122 -0
- data/_sass/sparrow-theme/modules/_navSearch.scss +161 -0
- data/_sass/sparrow-theme/modules/_preview.scss +99 -0
- data/_sass/sparrow-theme/modules/_sideNav.scss +41 -0
- data/_sass/sparrow-theme/modules/_spinner.scss +68 -0
- data/_sass/sparrow-theme/modules/_stepsList.scss +43 -0
- data/_sass/sparrow-theme/modules/_video.scss +13 -0
- data/_sass/sparrow-theme/vendor/_normalize.scss +429 -0
- data/_sass/sparrow-theme/vendor/_vendor.scss +3 -0
- data/assets/css/main.scss +7 -0
- data/assets/css/sparrow-theme.scss +38 -0
- data/assets/img/404.gif +0 -0
- data/assets/img/favicon.png +0 -0
- data/assets/img/touch.png +0 -0
- data/assets/js/scripts.js +5 -0
- data/assets/js/sparrow-theme/_partials/carousel.js +24 -0
- data/assets/js/sparrow-theme/_partials/catalog.js +226 -0
- data/assets/js/sparrow-theme/_partials/copyInput.js +107 -0
- data/assets/js/sparrow-theme/_partials/getData.js +23 -0
- data/assets/js/sparrow-theme/_partials/modal.js +51 -0
- data/assets/js/sparrow-theme/_partials/navigation.js +29 -0
- data/assets/js/sparrow-theme/_partials/scroll.js +102 -0
- data/assets/js/sparrow-theme/_partials/search.js +134 -0
- data/assets/js/sparrow-theme/_vendor/jquery-3.1.1.min.js +4 -0
- data/assets/js/sparrow-theme/_vendor/lunr.min.js +6 -0
- data/assets/js/sparrow-theme/_vendor/slick.min.js +18 -0
- data/assets/js/sparrow-theme/_vendor/uri.js +56 -0
- data/assets/js/sparrow-theme/sparrow-theme.js +23 -0
- metadata +71 -3
@@ -0,0 +1,38 @@
|
|
1
|
+
// General styles
|
2
|
+
@import
|
3
|
+
"bourbon",
|
4
|
+
"neat",
|
5
|
+
"sparrow-theme/vendor/normalize",
|
6
|
+
"sparrow-theme/base/variables",
|
7
|
+
"sparrow-theme/base/mixins",
|
8
|
+
"sparrow-theme/base/base",
|
9
|
+
"sparrow-theme/layout/404",
|
10
|
+
"sparrow-theme/layout/footer",
|
11
|
+
"sparrow-theme/layout/header",
|
12
|
+
"sparrow-theme/layout/layout",
|
13
|
+
"sparrow-theme/layout/page",
|
14
|
+
"sparrow-theme/modules/button",
|
15
|
+
"sparrow-theme/modules/card",
|
16
|
+
"sparrow-theme/modules/heroBanner",
|
17
|
+
"sparrow-theme/modules/modal",
|
18
|
+
"sparrow-theme/modules/spinner",
|
19
|
+
"sparrow-theme/modules/video"
|
20
|
+
;
|
21
|
+
|
22
|
+
// Search styles
|
23
|
+
{% if site.search %}
|
24
|
+
@import "sparrow-theme/modules/navSearch";
|
25
|
+
{% endif %}
|
26
|
+
|
27
|
+
// Catalog site styles
|
28
|
+
{% if site.catalog %}
|
29
|
+
@import
|
30
|
+
"sparrow-theme/layout/catalog",
|
31
|
+
"sparrow-theme/layout/component",
|
32
|
+
"sparrow-theme/modules/carousel",
|
33
|
+
"sparrow-theme/modules/componentCard",
|
34
|
+
"sparrow-theme/modules/actionPrompt",
|
35
|
+
"sparrow-theme/modules/sideNav",
|
36
|
+
"sparrow-theme/modules/preview"
|
37
|
+
;
|
38
|
+
{% endif %}
|
data/assets/img/404.gif
ADDED
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
(function ($, root, undefined) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
$(function() {
|
5
|
+
var prevArrow = $('.carousel__control--prev');
|
6
|
+
var nextArrow = $('.carousel__control--next');
|
7
|
+
|
8
|
+
$('.carousel__slides').slick({
|
9
|
+
prevArrow: prevArrow,
|
10
|
+
nextArrow: nextArrow,
|
11
|
+
dots: true,
|
12
|
+
dotsClass: 'carousel__dots',
|
13
|
+
responsive: [
|
14
|
+
{
|
15
|
+
breakpoint: 700,
|
16
|
+
settings: {
|
17
|
+
arrows: false,
|
18
|
+
}
|
19
|
+
}
|
20
|
+
]
|
21
|
+
});
|
22
|
+
});
|
23
|
+
|
24
|
+
})(jQuery, this);
|
@@ -0,0 +1,226 @@
|
|
1
|
+
var ComponentCard = (function() {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
function ComponentCard(data) {
|
5
|
+
this.url = data.url;
|
6
|
+
this.title = data.title;
|
7
|
+
this.categories = data.categories;
|
8
|
+
this.featured = data.featured;
|
9
|
+
this.image = data.image;
|
10
|
+
this.description = data.description;
|
11
|
+
}
|
12
|
+
|
13
|
+
ComponentCard.prototype.renderComponentCard = function() {
|
14
|
+
var truncatedDesctription = this.description.substring(0, 90);
|
15
|
+
var card = '<a href="' + this.url + '" class="componentCard__item componentCard__item--faded">' +
|
16
|
+
'<div class="componentCard__thumbnail" style="background-image: url(' + this.image + ');"></div>' +
|
17
|
+
'<div class="componentCard__content">' +
|
18
|
+
'<h3 class="componentCard__title">' + this.title + '</h3>' +
|
19
|
+
'<p class="componentCard__description">' + truncatedDesctription + '...</p>' +
|
20
|
+
'</div>' +
|
21
|
+
'</a>';
|
22
|
+
return card;
|
23
|
+
};
|
24
|
+
|
25
|
+
return ComponentCard;
|
26
|
+
})();
|
27
|
+
|
28
|
+
var Catalog = (function() {
|
29
|
+
'use strict';
|
30
|
+
|
31
|
+
function Catalog(element, data) {
|
32
|
+
this.data = data;
|
33
|
+
this.element = element;
|
34
|
+
this.catalogContent = this.element.find('.catalog__items');
|
35
|
+
this.filterLinks = this.element.find('.sideNav__link');
|
36
|
+
this.carousel = this.element.find('[data-content="carousel"]');
|
37
|
+
this.featuredContent = this.element.find('[data-content="featured"]');
|
38
|
+
this.newContent = this.element.find('[data-content="new"]');
|
39
|
+
this.featuredCollectionContent = this.element.find('[data-content="Featured Collections"]');
|
40
|
+
this.allCollectionContent = this.element.find('[data-content="All Collections"]');
|
41
|
+
this.filteredContent = this.element.find('[data-content="filtered"]');
|
42
|
+
this.filteredCardContainer = this.filteredContent.find('.componentCard');
|
43
|
+
this.filteredContentTitle = this.filteredContent.find('.catalog__title');
|
44
|
+
this.isMobile = window.matchMedia('(max-width: 700px)');
|
45
|
+
|
46
|
+
this.initialize();
|
47
|
+
}
|
48
|
+
|
49
|
+
Catalog.prototype.initialize = function() {
|
50
|
+
this.bindEvents();
|
51
|
+
this.showFeatured();
|
52
|
+
this.populateFromHistory();
|
53
|
+
this.animateCards();
|
54
|
+
};
|
55
|
+
|
56
|
+
Catalog.prototype.bindEvents = function() {
|
57
|
+
var self = this;
|
58
|
+
|
59
|
+
$('[data-filter]').click(function(e) {
|
60
|
+
var target = $(e.currentTarget);
|
61
|
+
var filterName = target.data('filter');
|
62
|
+
var filterValue = target.data('value');
|
63
|
+
var queryString = '?n=' + filterName + '&v=' + filterValue;
|
64
|
+
|
65
|
+
window.history.pushState({}, filterValue, queryString);
|
66
|
+
self.changeDisplay(filterName, filterValue);
|
67
|
+
self.scrollToContent();
|
68
|
+
});
|
69
|
+
|
70
|
+
window.onpopstate = function(event) {
|
71
|
+
self.populateFromHistory();
|
72
|
+
};
|
73
|
+
};
|
74
|
+
|
75
|
+
Catalog.prototype.scrollToContent = function() {
|
76
|
+
var scrollHeight = $('.heroBanner').height() - 50;
|
77
|
+
$(window).scrollTop(scrollHeight);
|
78
|
+
};
|
79
|
+
|
80
|
+
Catalog.prototype.showFeatured = function() {
|
81
|
+
this.resetDisplay();
|
82
|
+
this.catalogContent.append(this.carousel);
|
83
|
+
this.catalogContent.append(this.featuredContent);
|
84
|
+
this.catalogContent.append(this.newContent);
|
85
|
+
|
86
|
+
this.carousel.removeClass('catalog__section--hidden');
|
87
|
+
this.featuredContent.removeClass('catalog__section--hidden');
|
88
|
+
this.newContent.removeClass('catalog__section--hidden');
|
89
|
+
this.filterLinks.removeClass('sideNav__link--active');
|
90
|
+
this.carousel.removeClass('catalog__section--faded');
|
91
|
+
|
92
|
+
var featuredData = this.filterContent('featured', 'Featured Components', this.data);
|
93
|
+
var newData = this.filterContent('featured', 'New and Noteworthy', this.data);
|
94
|
+
|
95
|
+
this.renderComponentList(featuredData, this.featuredContent.find('.componentCard'), 2);
|
96
|
+
this.renderComponentList(newData, this.newContent.find('.componentCard'), 2);
|
97
|
+
};
|
98
|
+
|
99
|
+
Catalog.prototype.renderComponentList = function(data, container, limit) {
|
100
|
+
var self = this;
|
101
|
+
container.empty();
|
102
|
+
|
103
|
+
$.each(data, function(index, value){
|
104
|
+
var component = new ComponentCard(value);
|
105
|
+
var card = component.renderComponentCard();
|
106
|
+
container.append(card);
|
107
|
+
if (limit) return index < limit;
|
108
|
+
});
|
109
|
+
|
110
|
+
this.animateCards();
|
111
|
+
};
|
112
|
+
|
113
|
+
Catalog.prototype.animateCards = function() {
|
114
|
+
var index = 0;
|
115
|
+
var items = $('.componentCard__item');
|
116
|
+
var framesPerSecond = 30;
|
117
|
+
|
118
|
+
function animate() {
|
119
|
+
if (index <= items.length) {
|
120
|
+
setTimeout(function() {
|
121
|
+
window.requestAnimationFrame(animate);
|
122
|
+
$(items[index++]).removeClass('componentCard__item--faded');
|
123
|
+
}, 1000 / framesPerSecond);
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
animate();
|
128
|
+
};
|
129
|
+
|
130
|
+
Catalog.prototype.resetDisplay = function() {
|
131
|
+
$('.componentCard__item').addClass('componentCard__item--faded');
|
132
|
+
this.carousel = this.carousel.detach();
|
133
|
+
this.featuredContent = this.featuredContent.detach();
|
134
|
+
this.newContent = this.newContent.detach();
|
135
|
+
this.featuredCollectionContent = this.featuredCollectionContent.detach();
|
136
|
+
this.allCollectionContent = this.allCollectionContent.detach();
|
137
|
+
this.filteredContent = this.filteredContent.detach();
|
138
|
+
this.filterLinks.removeClass('sideNav__link--active');
|
139
|
+
};
|
140
|
+
|
141
|
+
Catalog.prototype.changeDisplay = function(filterName, filterValue) {
|
142
|
+
var selectedLink = $('.sideNav__link[data-value="' + filterValue + '"]');
|
143
|
+
|
144
|
+
this.resetDisplay();
|
145
|
+
selectedLink.addClass('sideNav__link--active');
|
146
|
+
|
147
|
+
if (filterValue === 'Featured Collections') {
|
148
|
+
this.catalogContent.html(this.featuredCollectionContent);
|
149
|
+
this.featuredCollectionContent.removeClass('catalog__section--hidden');
|
150
|
+
this.animateCards();
|
151
|
+
|
152
|
+
} else if (filterValue === 'All Collections') {
|
153
|
+
this.catalogContent.html(this.allCollectionContent);
|
154
|
+
this.allCollectionContent.removeClass('catalog__section--hidden');
|
155
|
+
this.animateCards();
|
156
|
+
|
157
|
+
} else {
|
158
|
+
this.catalogContent.html(this.filteredContent);
|
159
|
+
this.filteredContent.removeClass('catalog__section--hidden');
|
160
|
+
var filteredData = this.filterContent(filterName, filterValue, this.data);
|
161
|
+
this.renderComponentList(filteredData, this.filteredCardContainer);
|
162
|
+
}
|
163
|
+
};
|
164
|
+
|
165
|
+
Catalog.prototype.search = function(query) {
|
166
|
+
var self = this;
|
167
|
+
var results = window.idx.search(query);
|
168
|
+
var searchEntries = [];
|
169
|
+
this.resetDisplay();
|
170
|
+
this.catalogContent.append(this.filteredContent);
|
171
|
+
this.filteredContent.removeClass('catalog__section--hidden');
|
172
|
+
|
173
|
+
window.data.then(function(loaded_data) {
|
174
|
+
|
175
|
+
if (results.length) {
|
176
|
+
results.forEach(function(result) {
|
177
|
+
searchEntries.push(loaded_data[result.ref]);
|
178
|
+
});
|
179
|
+
|
180
|
+
self.filteredContentTitle.text('Results for ' + query);
|
181
|
+
self.renderComponentList(searchEntries, self.filteredCardContainer);
|
182
|
+
self.animateCards();
|
183
|
+
} else {
|
184
|
+
self.filteredContentTitle.text('No results found for ' + query);
|
185
|
+
}
|
186
|
+
|
187
|
+
self.scrollToContent();
|
188
|
+
});
|
189
|
+
};
|
190
|
+
|
191
|
+
Catalog.prototype.populateFromHistory = function() {
|
192
|
+
var uri = new URI(window.location.search.toString());
|
193
|
+
var queryString = uri.search(true);
|
194
|
+
|
195
|
+
if (queryString.hasOwnProperty('n') && queryString.hasOwnProperty('v')) {
|
196
|
+
this.changeDisplay(queryString.n.toString(), queryString.v.toString());
|
197
|
+
if (this.isMobile.matches) this.scrollToContent();
|
198
|
+
} else if (queryString.hasOwnProperty('q')) {
|
199
|
+
this.search(queryString.q.toString());
|
200
|
+
} else {
|
201
|
+
this.showFeatured();
|
202
|
+
}
|
203
|
+
};
|
204
|
+
|
205
|
+
Catalog.prototype.filterContent = function(filterName, filterValue, data) {
|
206
|
+
this.filteredContentTitle.text(filterValue);
|
207
|
+
|
208
|
+
var filteredData = data.filter(function(n, i) {
|
209
|
+
var data = n[filterName].split(', ');
|
210
|
+
return data.indexOf(filterValue) !== -1;
|
211
|
+
});
|
212
|
+
|
213
|
+
return filteredData;
|
214
|
+
};
|
215
|
+
|
216
|
+
return Catalog;
|
217
|
+
})();
|
218
|
+
|
219
|
+
$(function() {
|
220
|
+
// Only run for catalog pages
|
221
|
+
if ($('.catalog').length) {
|
222
|
+
window.data.then(function(data) {
|
223
|
+
var catalog = new Catalog($('.catalog'), data);
|
224
|
+
});
|
225
|
+
}
|
226
|
+
});
|
@@ -0,0 +1,107 @@
|
|
1
|
+
var CopyNotification = (function() {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
function CopyNotification(message) {
|
5
|
+
this.message = message;
|
6
|
+
this.copyInput = $('.copyInput');
|
7
|
+
}
|
8
|
+
|
9
|
+
CopyNotification.prototype.render = function() {
|
10
|
+
var copyNotification = '<div class="copyInput__notification">' + this.message + '</div>';
|
11
|
+
return copyNotification;
|
12
|
+
};
|
13
|
+
|
14
|
+
CopyNotification.prototype.animate = function() {
|
15
|
+
var animationEnd = 'webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationend';
|
16
|
+
var notification = this.copyInput.find('.copyInput__notification');
|
17
|
+
var fired = false;
|
18
|
+
notification.addClass('copyInput__notification--animating');
|
19
|
+
|
20
|
+
notification.one(animationEnd, function(e) {
|
21
|
+
if (!fired) {
|
22
|
+
fired = true;
|
23
|
+
notification.remove();
|
24
|
+
}
|
25
|
+
});
|
26
|
+
};
|
27
|
+
|
28
|
+
return CopyNotification;
|
29
|
+
})();
|
30
|
+
|
31
|
+
var CopyInput = (function() {
|
32
|
+
function CopyInput(element) {
|
33
|
+
this.element = element;
|
34
|
+
this.copyButton = this.element.find('.copyInput__button');
|
35
|
+
this.copyInputText = this.element.find('.copyInput__input');
|
36
|
+
this.copyInputClass = '.' + this.element.attr('class');
|
37
|
+
this.copyInputTextClass = this.copyInputText.attr('class');
|
38
|
+
this.bindEvents();
|
39
|
+
}
|
40
|
+
|
41
|
+
CopyInput.prototype.bindEvents = function() {
|
42
|
+
var self = this;
|
43
|
+
this.copyButton.on('click', function(e) {
|
44
|
+
e.preventDefault();
|
45
|
+
e.stopPropagation();
|
46
|
+
var copyTextParent = self.getClosest(this, self.copyInputClass);
|
47
|
+
var copyText = self.getChild(copyTextParent, self.copyInputTextClass);
|
48
|
+
self.copyToClipboard(copyText);
|
49
|
+
});
|
50
|
+
|
51
|
+
this.copyInputText.focus(function() {
|
52
|
+
$(this).select();
|
53
|
+
});
|
54
|
+
};
|
55
|
+
|
56
|
+
CopyInput.prototype.getClosest = function(elem, selector) {
|
57
|
+
var firstChar = selector.charAt(0);
|
58
|
+
|
59
|
+
// Get closest match
|
60
|
+
for (; elem && elem !== document; elem = elem.parentNode) {
|
61
|
+
if (firstChar === '.' ) {
|
62
|
+
if (elem.classList.contains(selector.substr(1))) {
|
63
|
+
return elem;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
return false;
|
68
|
+
};
|
69
|
+
|
70
|
+
CopyInput.prototype.getChild = function(elem, selector) {
|
71
|
+
for (var i = 0; i < elem.childNodes.length; i++) {
|
72
|
+
if (elem.childNodes[i].className == selector) {
|
73
|
+
return elem.childNodes[i];
|
74
|
+
}
|
75
|
+
}
|
76
|
+
};
|
77
|
+
|
78
|
+
CopyInput.prototype.copyToClipboard = function(copyText) {
|
79
|
+
window.getSelection().removeAllRanges();
|
80
|
+
var range = document.createRange();
|
81
|
+
range.selectNode(copyText);
|
82
|
+
window.getSelection().addRange(range);
|
83
|
+
|
84
|
+
try {
|
85
|
+
var successful = document.execCommand('copy');
|
86
|
+
var msg = successful ? 'copied' : 'not copied';
|
87
|
+
var copyNotification = new CopyNotification(msg);
|
88
|
+
$('.copyInput__notification').remove();
|
89
|
+
|
90
|
+
this.copyButton.append(copyNotification.render());
|
91
|
+
copyNotification.animate();
|
92
|
+
|
93
|
+
} catch(err) {
|
94
|
+
alert('Oops, unable to copy');
|
95
|
+
}
|
96
|
+
|
97
|
+
window.getSelection().removeAllRanges();
|
98
|
+
};
|
99
|
+
|
100
|
+
return CopyInput;
|
101
|
+
})();
|
102
|
+
|
103
|
+
$(function() {
|
104
|
+
if ($('.copyInput').length) {
|
105
|
+
new CopyInput($('.copyInput'));
|
106
|
+
}
|
107
|
+
});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
(function ($, root, undefined) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// Initalize lunr with the fields it will be searching on
|
5
|
+
window.idx = lunr(function() {
|
6
|
+
this.ref('id');
|
7
|
+
{% for field in site.search.fields %}
|
8
|
+
this.field('{{ field.title }}'{% if field.boost %}, {boost: {{ field.boost }}}{% endif %});
|
9
|
+
{% endfor %}
|
10
|
+
});
|
11
|
+
|
12
|
+
// Download the data from the JSON file we generated
|
13
|
+
window.data = $.getJSON('{{ site.search.data-url }}');
|
14
|
+
|
15
|
+
// Wait for the data to load and add it to lunr
|
16
|
+
window.data.then(function(loaded_data){
|
17
|
+
$.each(loaded_data, function(index, value){
|
18
|
+
window.idx.add(
|
19
|
+
$.extend({ "id": index }, value)
|
20
|
+
);
|
21
|
+
});
|
22
|
+
});
|
23
|
+
})(jQuery, this);
|