Skip to content

Commit 2516317

Browse files
committed
Enhance Examples pages with code template update when user change option and prepare doc for multiple API version pages
1 parent cd9aa3a commit 2516317

27 files changed

+1471
-811
lines changed

CHANGELOG.md

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1+
## X.X.X
2+
3+
### Features
4+
5+
- Add custom direction ([rhanb](https://github.com/rhanb))
6+
7+
### Miscellaneous
8+
9+
- Update local server config to latest Hapi version
10+
11+
112
## 1.1.1
213

314
### Miscellaneous
415

516
- Update dependencies
6-
- Update gulpfile with last gulp version
17+
- Update gulpfile with latest gulp version
718
- Update node versions on for Travis CI tests
819

920

@@ -39,15 +50,15 @@
3950

4051
- Reduce CPU footprint for Chrome
4152
- Add option to change default state name
42-
- Add Karma / Jasmine tests
43-
- Add Code coverage
53+
- Add Karma / Jasmine tests ([pranaygp](https://github.com/pranaygp))
54+
- Add Code coverage ([pranaygp](https://github.com/pranaygp))
55+
- Can set HTMLCanvasElement directly instead of CSS selector ([suhaotian](https://github.com/suhaotian))
4456

4557
### Miscellaneous
4658

47-
- Add to NPM registry
48-
- Add to Bower registry
49-
- Add `CONTRIBUTING.md`
59+
- Add to NPM and Bower registry
60+
- Add `CONTRIBUTING.md` ([pranaygp](https://github.com/pranaygp))
5061
- Add `CHANGELOG.md`
5162
- Updated `README.md`
52-
- Docs fixes and improvements
63+
- Docs fixes and improvements ([howdy39](https://github.com/howdy39), [M-arcus](https://github.com/M-arcus) and [YLiohenki](https://github.com/YLiohenki))
5364
- Create a Gitter Channel

docs/api-v1.1.1.html

+179
Large diffs are not rendered by default.

docs/api-v2.0.0.html

+184
Large diffs are not rendered by default.

docs/api.html

+11-140
Large diffs are not rendered by default.

docs/assets/css/scss/header.scss

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@
6161
transition-property: color, border;
6262
transition-duration: .3s;
6363
&:first-child {margin-left: 0}
64-
&.text:hover {
64+
&.text-link:hover {
6565
color: #1abc9c;
6666
@include tab-desk {
6767
border-color: #1abc9c;
6868
}
6969
}
70-
&.text {
70+
&.text-link {
7171
padding: 15px 5px;
7272
@include tab-desk {
7373
border-bottom: solid 2px #eee;
7474
}
7575
}
76-
&.text.active, &.text.active:hover {
77-
color: #16a085;
76+
&.text-link.active, &.text-link.active:hover {
77+
color: $color-green-main;
7878
@include tab-desk {
79-
border-color: #16a085;
79+
border-color: $color-green-main;
8080
}
8181
}
8282
}
@@ -142,7 +142,7 @@
142142
position: absolute;
143143
height: 5px;
144144
width: 50%;
145-
background: #16a085;
145+
background: $color-green-main;
146146
opacity: 1;
147147
-webkit-transform: rotate(0deg);
148148
-moz-transform: rotate(0deg);

docs/assets/css/scss/main.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
body {
66
margin: 0;
7-
font-family: Roboto, Helvetica, Arial, sans-serif;
7+
font-family: $font-main;
88
color: #252525;
99
}
1010

11-
h1, h2, h3 {color: #16a085}
11+
h1, h2, h3 {color: $color-green-main}
1212

1313
h1 {
1414
font-size: 2.875em;

docs/assets/css/scss/pages/api.scss

+27
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,33 @@ body.api {
66
padding-top: 50px;
77
}
88

9+
.api-versions-list li {
10+
font-size: 1.75em;
11+
margin-bottom: 15px;
12+
a {
13+
color: #444;
14+
&:hover {color: $color-green-main}
15+
}
16+
}
17+
18+
.title-bloc {
19+
display: flex;
20+
justify-content: space-between;
21+
align-items: center;
22+
23+
.api-version {
24+
font-size: .5em;
25+
font-weight: bold;
26+
}
27+
28+
#version-select {
29+
padding: 5px;
30+
border-color: $color-green-main;
31+
font-size: 1em;
32+
font-family: $font-main;
33+
}
34+
}
35+
936
table.api-list {
1037
width: 100%;
1138
text-align: left;

docs/assets/css/scss/pages/examples.scss

+12-5
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,29 @@ body.examples {
2828

2929
.sandbox-footer {
3030
position: relative;
31+
display: flex;
32+
align-items: baseline;
3133
padding: 10px 20px;
3234
background-color: #f5f2f0;
3335
margin-top: -4px;
3436
border-radius: 0 0 4px 4px;
3537
z-index: 1;
3638

37-
span {
39+
.option {
3840
font-size: 14px;
3941
font-weight: bold;
40-
}
42+
margin-right: 15px;
43+
&:last-child {margin-right: 0}
4144

42-
select {margin-left: 5px}
45+
input[type=checkbox] {
46+
position: relative;
47+
top: 2px;
48+
}
49+
50+
select {margin-left: 5px}
51+
}
4352
}
4453

45-
.sandbox-footer p {margin: 0}
46-
4754
.code-wrapper {margin-top: 30px}
4855

4956
#canvas-image {

docs/assets/css/scss/var.scss

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Default value
2+
$font-main: Roboto, Helvetica, Arial, sans-serif;
3+
$color-green-main: #16a085;
4+
15
// Responsive breakpoints
26
$sm: 768px;
37
$md: 992px;

docs/assets/css/style.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/js/app/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
var main = require('./main.js'),
44
home = require('./pages/home.js'),
5-
examples = require('./pages/examples.js');
5+
examples = require('./pages/examples.js'),
6+
api = require('./pages/api.js');
67

78
$(document).on('DOMContentLoaded', function() {
89
switch(pageId) {
@@ -18,6 +19,7 @@ $(document).on('DOMContentLoaded', function() {
1819

1920
case 'api':
2021
main.init();
22+
api.init();
2123
break;
2224
}
2325
});

docs/assets/js/app/main.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
init: function() {
55
this.logoAnimation();
66
this.hamburgerIcon();
7+
this.setActiveClassOnCurrentNav();
78
},
89

910
logoAnimation: function() {
@@ -27,18 +28,23 @@ module.exports = {
2728
}
2829
});
2930

30-
$('.main-header .bloc-logo').css({
31-
display: 'none',
32-
visibility: 'visible'
33-
})
31+
$('.main-header .bloc-logo')
32+
.css({
33+
display: 'none',
34+
visibility: 'visible'
35+
})
3436
.fadeIn();
3537
}, 500);
3638
},
3739

3840
hamburgerIcon: function() {
39-
$('.hamburger-icon').click(function(){
41+
$('.hamburger-icon').click(function() {
4042
$(this).toggleClass('open');
4143
$('.main-nav').toggleClass('open');
4244
});
45+
},
46+
47+
setActiveClassOnCurrentNav: function() {
48+
$('#nav-' + pageId).addClass('active');
4349
}
4450
};

docs/assets/js/app/pages/api.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
module.exports = {
4+
init: function() {
5+
this.setDefaultVersionOnDropDown();
6+
this.HandleVersionDropDown();
7+
8+
},
9+
10+
setDefaultVersionOnDropDown: function() {
11+
var pathName = document.location.pathname;
12+
$('#version-select option').each(function(i, el) {
13+
if (el.value === pathName) {
14+
$(el).attr({ selected: true })
15+
}
16+
})
17+
},
18+
19+
HandleVersionDropDown: function() {
20+
$('#version-select').on('change', function(event) {
21+
$(location).attr({ pathname: $(this).val() })
22+
})
23+
}
24+
};

docs/assets/js/app/pages/examples.js

+21-28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
var codeTemplates = require('../utils/codeTemplate.js');
4+
35
module.exports = {
46
init: function() {
57
this.examples.init();
@@ -8,7 +10,6 @@ module.exports = {
810
examples: {
911
init: function() {
1012
this.basic();
11-
this.basicCustom();
1213
this.imageBlending();
1314
this.imageMask();
1415
this.interactive();
@@ -19,33 +20,12 @@ module.exports = {
1920
element: '#canvas-basic',
2021
name: 'basic-gradient',
2122
direction: 'left-right',
22-
opacity: [1, 1],
23-
isPausedWhenNotInView: true,
24-
states: {
25-
"default-state": {
26-
gradients: [
27-
['#ff9966', '#ff5e62'],
28-
['#00F260', '#0575E6'],
29-
['#e1eec3', '#f05053']
30-
]
31-
}
32-
}
33-
});
34-
$('#select-direction').on('change', function() {
35-
animation.direction = $(this).val();
36-
})
37-
},
38-
basicCustom: function() {
39-
var animation = new Granim({
40-
element: '#canvas-basic-custom',
41-
name: 'basic-gradient-custom',
4223
customDirection: {
43-
x0: '20%',
44-
y0: '200px',
45-
x1: '30%',
46-
y1: '400px'
24+
x0: '40%',
25+
y0: '10px',
26+
x1: '60%',
27+
y1: '50%'
4728
},
48-
direction: 'custom',
4929
opacity: [1, 1],
5030
isPausedWhenNotInView: true,
5131
states: {
@@ -58,8 +38,15 @@ module.exports = {
5838
}
5939
}
6040
});
41+
6142
$('#select-direction').on('change', function() {
62-
animation.direction = $(this).val();
43+
var directionValue = $(this).val();
44+
animation.changeDirection(directionValue);
45+
46+
$('#canvas-basic-bloc .language-js').html(
47+
$(codeTemplates.basic({ direction: directionValue }))
48+
);
49+
Prism.highlightAll();
6350
})
6451
},
6552

@@ -89,7 +76,13 @@ module.exports = {
8976
});
9077

9178
$('#select-blending-mode').on('change', function() {
92-
animation.changeBlendingMode($(this).val());
79+
var blendingModeValue = $(this).val();
80+
animation.changeBlendingMode(blendingModeValue);
81+
82+
$('#canvas-image-blending-bloc .language-js').html(
83+
$(codeTemplates.blendingMode({ blendingMode: blendingModeValue }))
84+
);
85+
Prism.highlightAll();
9386
})
9487
},
9588

0 commit comments

Comments
 (0)