Skip to content

Commit 129fb8d

Browse files
committed
minor code formatting css improvements
1 parent fa210d2 commit 129fb8d

File tree

4 files changed

+98
-106
lines changed

4 files changed

+98
-106
lines changed

site/_css/index.less

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ body.index {
115115
-webkit-font-smoothing: auto;
116116
-moz-osx-font-smoothing: auto;
117117
color: white;
118-
background: transparent;
119-
box-shadow: none;
120-
padding: 0;
121-
margin: 0;
122118
}
123119

124120
&:last-child > .prism {
@@ -218,6 +214,10 @@ body.index {
218214
top: 0;
219215
width: 100%;
220216
}
217+
218+
.prism {
219+
padding: 1ch;
220+
}
221221
}
222222

223223
section.point1 {
@@ -247,13 +247,6 @@ body.index {
247247
border-bottom: solid 5px #e0e0e0;
248248
}
249249

250-
.prism {
251-
background: none;
252-
box-shadow: none;
253-
margin: 0;
254-
padding: 1ch;
255-
}
256-
257250
.cursor {
258251
width: 7px;
259252
height: 15px;
@@ -309,13 +302,6 @@ body.index {
309302
top: -35px;
310303
}
311304

312-
.prism {
313-
background: none;
314-
box-shadow: none;
315-
margin: 0;
316-
padding: 0;
317-
}
318-
319305
.query, .response {
320306
position: absolute;
321307
}
@@ -407,13 +393,6 @@ body.index {
407393
top: 8px;
408394
background: lighten(@dark-color, 80%);
409395
}
410-
411-
.prism {
412-
background: none;
413-
box-shadow: none;
414-
margin: 0;
415-
padding: 1ch;
416-
}
417396
}
418397
}
419398

site/_css/prism.less

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
@import "variables.less";
22

3-
.prism {
4-
position: relative;
5-
6-
@media screen and (max-width: 1020px) {
7-
padding: 4px 8px;
8-
margin-left: -12px;
9-
font-size: 11px;
10-
}
11-
12-
@media print {
13-
text-shadow: none;
14-
}
15-
}
16-
17-
.prism + .prism {
18-
margin-top: -15px;
19-
}
20-
213
.prism {
224
.code-font();
235
direction: ltr;
@@ -35,39 +17,61 @@
3517
-ms-hyphens: none;
3618
hyphens: none;
3719

38-
font-size: 13px;
39-
line-height: 17px;
40-
background: white;
41-
box-shadow: inset 0 0 0 1px #EEE, inset 4px 0 0 #EEE;
42-
border-radius: 3px;
43-
44-
.line-highlight {
45-
background-color: rgba(229, 53, 171, 0.15);
46-
left: 0;
47-
line-height: inherit;
48-
margin-top: 5px;
49-
pointer-events: none;
50-
position: absolute;
51-
right: 0;
52-
}
20+
position: relative;
5321
}
5422

55-
.not(code) > pre.prism {
56-
text-shadow: 0 1px white;
23+
// Used in docs, but not on index. todo: move.
24+
.inner-content {
25+
.prism {
26+
position: relative;
27+
background: white;
28+
box-shadow: inset 0 0 0 1px #EEE, inset 4px 0 0 #EEE;
29+
border-radius: 3px;
30+
31+
.line-highlight {
32+
background-color: rgba(229, 53, 171, 0.15);
33+
left: 0;
34+
line-height: inherit;
35+
margin-top: 5px;
36+
pointer-events: none;
37+
position: absolute;
38+
right: 0;
39+
}
40+
41+
@media screen and (max-width: 1020px) {
42+
padding: 4px 8px;
43+
margin-left: -12px;
44+
font-size: 11px;
45+
}
46+
47+
@media print {
48+
text-shadow: none;
49+
}
50+
}
5751

58-
&::-moz-selection, &::selection {
59-
text-shadow: none;
52+
.prism + .prism {
53+
margin-top: -15px;
6054
}
61-
}
6255

63-
// Code blocks
64-
pre.prism {
65-
padding: 7px 14px;
66-
margin-left: -4px;
67-
margin-bottom: 10px;
68-
overflow: auto;
56+
.not(code) > pre.prism {
57+
text-shadow: 0 1px white;
58+
59+
&::-moz-selection, &::selection {
60+
text-shadow: none;
61+
}
62+
}
63+
64+
// Code blocks
65+
pre.prism {
66+
padding: 7px 14px;
67+
margin-left: -4px;
68+
margin-bottom: 10px;
69+
overflow: auto;
70+
}
6971
}
7072

73+
74+
7175
// Colors
7276
// .prism {
7377
// .comment,

site/_css/variables.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
font-weight: 400;
2525
color: @color;
2626
font-size: @size;
27-
line-height: @size * 1.3;
27+
line-height: @size * 17/13;
2828
}

site/index.html.js

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -140,44 +140,44 @@ var index = React.createClass({
140140
</Prism>
141141
</div>
142142
</div>
143-
</div>
144-
<script dangerouslySetInnerHTML={{__html: `(function(){
145-
var i = 0;
146-
var forward = true;
147-
setTimeout(type, 2000);
148-
showResponse(1);
149-
function type() {
150-
if (forward) {
151-
document.getElementById('ch' + i).style.display = 'inline';
152-
i++;
153-
if (i === 27) {
154-
forward = false;
155-
showResponse(3);
156-
setTimeout(type, 1500);
157-
} else if (i === 13) {
158-
showResponse(2);
159-
setTimeout(type, 1500);
160-
} else {
161-
setTimeout(type, Math.random() * 180 + 70);
162-
}
163-
} else {
164-
i--;
165-
document.getElementById('ch' + i).style.display = 'none';
166-
if (i === 0) {
167-
forward = true;
168-
showResponse(1);
169-
setTimeout(type, 2000);
143+
<script dangerouslySetInnerHTML={{__html: `(function(){
144+
var i = 0;
145+
var forward = true;
146+
setTimeout(type, 2000);
147+
showResponse(1);
148+
function type() {
149+
if (forward) {
150+
document.getElementById('ch' + i).style.display = 'inline';
151+
i++;
152+
if (i === 27) {
153+
forward = false;
154+
showResponse(3);
155+
setTimeout(type, 1500);
156+
} else if (i === 13) {
157+
showResponse(2);
158+
setTimeout(type, 1500);
159+
} else {
160+
setTimeout(type, Math.random() * 180 + 70);
161+
}
170162
} else {
171-
setTimeout(type, 80);
163+
i--;
164+
document.getElementById('ch' + i).style.display = 'none';
165+
if (i === 0) {
166+
forward = true;
167+
showResponse(1);
168+
setTimeout(type, 2000);
169+
} else {
170+
setTimeout(type, 80);
171+
}
172172
}
173173
}
174-
}
175-
function showResponse(num) {
176-
document.getElementById('r1').style.display = num === 1 ? 'block' : 'none';
177-
document.getElementById('r2').style.display = num === 2 ? 'block' : 'none';
178-
document.getElementById('r3').style.display = num === 3 ? 'block' : 'none';
179-
}
180-
})()`}} />
174+
function showResponse(num) {
175+
document.getElementById('r1').style.display = num === 1 ? 'block' : 'none';
176+
document.getElementById('r2').style.display = num === 2 ? 'block' : 'none';
177+
document.getElementById('r3').style.display = num === 3 ? 'block' : 'none';
178+
}
179+
})()`}} />
180+
</div>
181181
</section>
182182

183183
<div className="grayWash">
@@ -290,7 +290,6 @@ type Species {
290290
}`}
291291
</Prism>
292292
</div>
293-
</div>
294293
<script dangerouslySetInnerHTML={{__html: `(function(){
295294
var typeHighlight = document.getElementById('type-highlight');
296295
var queryHighlight = document.getElementById('query-highlight');
@@ -305,6 +304,7 @@ type Species {
305304
setTimeout(highlightLine, 800 + Math.random() * 200);
306305
}
307306
})()`}} />
307+
</div>
308308
</section>
309309

310310
<div className="darkWash">
@@ -339,6 +339,15 @@ type Species {
339339
APIs give apps easier access to new features and enable cleaner,
340340
more maintainable server&nbsp;code.</p>
341341
</div>
342+
<div className="window type-evolution" aria-hidden>
343+
<Prism language="graphql">
344+
{`type Film {
345+
title: String
346+
episode: Int
347+
director: String
348+
}`}
349+
</Prism>
350+
</div>
342351
</section>
343352
</div>
344353

0 commit comments

Comments
 (0)