Skip to content

Commit f220121

Browse files
author
Jordan McCullough
committed
Merge pull request #32 from github/workbooks
Simplify cheatsheet/outline dichotomy, unify under Workbook page content
2 parents c505278 + fe6ed1b commit f220121

File tree

14 files changed

+852
-305
lines changed

14 files changed

+852
-305
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ end
88
task :test do
99
sh 'bundle exec sass _stylesheets/page.scss:_stylesheets/page.css'
1010
sh 'bundle exec sass _stylesheets/home.scss:_stylesheets/home.css'
11-
sh 'bundle exec sass _stylesheets/outline.scss:_stylesheets/outline.css'
11+
sh 'bundle exec sass _stylesheets/workbook.scss:_stylesheets/workbook.css'
1212

1313
sh 'bundle exec jekyll build'
1414

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ exclude:
2222

2323
include:
2424
- _stylesheets
25+
- _javascript
2526

2627
markdown: rdiscount

_includes/license.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="license">
2-
<a href="../license.html">Shared with the community under license</a>
2+
<a href="../license.html">Shared with the community under a Creative Commons license</a>
33
</div>

_javascript/workbook.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
(function(){
2+
var scopeRadios = [];
3+
4+
scopeRadios.push(document.getElementById("outline"));
5+
scopeRadios.push(document.getElementById("summary"));
6+
scopeRadios.push(document.getElementById("details"));
7+
8+
for(var i=0; i<scopeRadios.length; i++){
9+
scopeRadios[i].addEventListener("click", switchScope);
10+
11+
if(scopeRadios[i].checked){
12+
switchScope(false, scopeRadios[i].id);
13+
}
14+
}
15+
16+
function switchScope(event, id){
17+
var activeId;
18+
19+
if(event){
20+
activeId = event.target.id;
21+
}
22+
else if (id){
23+
activeId = id;
24+
}
25+
26+
console.log("ActiveId: " + activeId);
27+
28+
var scopeWrapper = document.getElementById("scope");
29+
30+
switch(activeId){
31+
case "outline":
32+
showSet(scopeWrapper, "outline");
33+
break;
34+
case "summary":
35+
showSet(scopeWrapper, "summary");
36+
break;
37+
case "details":
38+
showSet(scopeWrapper, "details");
39+
break;
40+
}
41+
}
42+
43+
function showSet(wrapper, scope){
44+
console.log("Changing scope");
45+
wrapper.className = scope;
46+
}
47+
function selection(identifier){
48+
var allEl = document.getElementsByClassName(identifier);
49+
return allEl;
50+
}
51+
})();

_layouts/workbook.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
layout: bare
3+
theme: workbook
4+
---
5+
6+
<section class="hero">
7+
<div class="container">
8+
<span class="octicon octicon-book"></span><h1>{{ page.title }}</h1>
9+
{% include license.html %}
10+
</div>
11+
</section>
12+
13+
<section>
14+
<div class="container">
15+
16+
<div class="tab-panel">
17+
18+
<input type="radio" class="material-type" name="material-scope" id="outline" value="outline">
19+
<label class="tab column-3up" for="outline">
20+
<span>Outline</span>
21+
</label>
22+
23+
<input type="radio" class="material-type" name="material-scope" id="summary" value="summary" checked="checked">
24+
<label class="tab column-3up" for="summary">
25+
<span>Summary</span>
26+
</label>
27+
28+
<input type="radio" class="material-type" name="material-scope" id="details" value="details">
29+
<label class="tab column-3up" for="details">
30+
<span>Details</span>
31+
</label>
32+
</div>
33+
34+
<!-- <nav class="toc">
35+
TOC
36+
</nav> -->
37+
38+
<span id="scope">
39+
{{ content }}
40+
</span>
41+
</div>
42+
</section>
43+
44+
{% include footer.html %}
45+
46+
47+
<script src="../_javascript/workbook.js"></script>

_stylesheets/core.css

Lines changed: 0 additions & 64 deletions
This file was deleted.

_stylesheets/core.scss

Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ h1{
55
}
66
h2{
77
font-size: 200%;
8-
line-height: 150%;
8+
// line-height: 150%;
9+
margin: 20px 0 0 0;
910
color: #222;
1011
}
1112
h2+p{
@@ -14,7 +15,7 @@ h2+p{
1415
text-rendering: optimizeLegibility;
1516
line-height: 150%;
1617
opacity: .65;
17-
margin: auto auto 20px auto;
18+
// margin: auto auto 20px auto;
1819
}
1920
h3{
2021
font-size: 125%;
@@ -24,6 +25,7 @@ h3{
2425
p{
2526
text-rendering: optimizeLegibility;
2627
line-height: 150%;
28+
margin-bottom: 1em;
2729
}
2830
header{
2931
background: #fff;
@@ -91,14 +93,12 @@ code{
9193
}
9294
pre{
9395
width: 100%;
94-
background: #222;
95-
line-height: 140%;
96-
margin: 30px 0;
96+
// background: #222;
97+
background: rgba(0,0,0,.04);
9798
border-radius: 3px;
99+
padding: 0 10px;
98100

99101
code{
100-
display: block;
101-
padding: 10px;
102102
}
103103
}
104104
table{
@@ -167,3 +167,102 @@ ul{
167167
padding: 5px;
168168
}
169169
}
170+
171+
.tab-panel{
172+
background: #fff;
173+
position: block;
174+
margin: 30px auto 0 auto;
175+
height: 2em;
176+
width: 360px;
177+
position: relative;
178+
179+
label{
180+
background: #f5f5f5;
181+
-webkit-transition: background 250ms ease-in-out;
182+
183+
&:hover{
184+
background: #fff;
185+
}
186+
}
187+
188+
.column-2up{
189+
width: 50%;
190+
}
191+
.column-3up{
192+
width: 33%;
193+
}
194+
.column-4up{
195+
width: 25%;
196+
}
197+
198+
.tab{
199+
float: left;
200+
box-shadow: 0 0 0 1px #dfdfdf;
201+
202+
&.first{
203+
border-top-left-radius: 5px;
204+
border-bottom-left-radius: 5px;
205+
border-right: none;
206+
}
207+
&.last{
208+
border-top-right-radius: 5px;
209+
border-bottom-right-radius: 5px;
210+
border-left: none;
211+
}
212+
& > span{
213+
display: block;
214+
text-align: center;
215+
margin: 10px;
216+
opacity: .6;
217+
font-size: 80%;
218+
}
219+
}
220+
221+
.panel-content{
222+
width: 200%;
223+
visibility: hidden;
224+
// opacity: 0;
225+
position: absolute;
226+
left: -50%;
227+
228+
-webkit-transition: opacity 400ms;
229+
transition: opacity 400ms;
230+
231+
.octicon-hero{
232+
display: inline-block;
233+
padding: 0 10px;
234+
color: #ddd;
235+
}
236+
p{
237+
font-size: 80%;
238+
text-align: center;
239+
margin: 20px 0;
240+
font-weight: 200;
241+
}
242+
ul{
243+
text-align: center;
244+
}
245+
li{
246+
display: inline-block;
247+
}
248+
}
249+
250+
input.material-type{
251+
position: absolute;
252+
left: -999px;
253+
254+
&:checked + label{
255+
background: $color-bright;
256+
257+
& > span{
258+
color: #fff;
259+
opacity: 1;
260+
}
261+
}
262+
263+
&:checked + label.tab > div.panel-content{
264+
visibility: visible;
265+
// opacity: 1;
266+
}
267+
}
268+
}

0 commit comments

Comments
 (0)