Skip to content

Commit 6447d20

Browse files
committed
when < 768px, left nav becomes a drawer, which animates out. tested all the way down to iphone4
Closes #728 LGTM given by: @sethladd, @devoncarew Squashed commit of the following: commit 1050a03 Author: Seth Ladd <[email protected]> Date: Fri Jul 24 09:29:25 2015 -0700 when < 768px, left nav becomes a drawer, which animates out. tested all the way down to iphone4
1 parent 8c844a1 commit 6447d20

22 files changed

+405
-470
lines changed

lib/resources/styles.css

Lines changed: 112 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ body {
2424
overflow-x: hidden;
2525
}
2626

27+
nav {
28+
font-size: 17px;
29+
}
30+
2731
/* some of this is to reset bootstrap */
2832
nav.navbar {
2933
background-color: inherit;
@@ -37,6 +41,10 @@ nav.navbar {
3741
-webkit-justify-content: center;
3842
}
3943

44+
nav .container {
45+
white-space: nowrap;
46+
}
47+
4048
header {
4149
background-color: #607D8B;
4250
color: white;
@@ -51,6 +59,10 @@ header.container-fluid {
5159
padding: 0;
5260
}
5361

62+
header .masthead {
63+
padding-top: 64px;
64+
}
65+
5466
.body {
5567
margin-top: 24px;
5668
}
@@ -79,7 +91,7 @@ h1.title {
7991
}
8092

8193
h2 {
82-
font-size: 32px;
94+
font-size: 24px;
8395
}
8496

8597
h5 {
@@ -174,7 +186,6 @@ code {
174186
}
175187

176188
header h1 {
177-
margin-top: 80px;
178189
font-weight: 400;
179190
margin-bottom: 16px;
180191
}
@@ -208,12 +219,6 @@ section.summary h2 {
208219
border-bottom: 1px solid #CFD8DC;
209220
}
210221

211-
section.summary dd {
212-
white-space: nowrap;
213-
overflow-x: hidden;
214-
text-overflow: ellipsis;
215-
}
216-
217222
/* indents wrapped lines */
218223
section.summary dt {
219224
margin-left: 24px;
@@ -315,27 +320,27 @@ footer .container-fluid {
315320

316321
.gt-separated {
317322
list-style: none;
318-
padding: 0;
319-
display: inline;
320323
}
321324

322325
.gt-separated li {
323-
display: inline;
326+
display: inline-block;
324327
}
325328

326-
.gt-separated li:after {
329+
.gt-separated li:before {
327330
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='#FFFFFF' d='M6.7,4L5.7,4.9L8.8,8l-3.1,3.1L6.7,12l4-4L6.7,4z'/></svg>");
328331
background-position: center;
329-
content: " ";
330-
padding-left: 16px;
332+
content: "\00a0";
333+
margin: 0 16px 0 12px;
331334
}
332335

333-
.gt-separated.dark li:after {
336+
.gt-separated.dark li:before {
334337
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='#727272' d='M6.7,4L5.7,4.9L8.8,8l-3.1,3.1L6.7,12l4-4L6.7,4z'/></svg>");
335338
}
336339

337-
.gt-separated li:last-child:after {
340+
.gt-separated li:first-child:before {
338341
background-image: none;
342+
content: "";
343+
margin: 0;
339344
}
340345

341346
.is-inherited {
@@ -351,12 +356,25 @@ footer .container-fluid {
351356
padding: 0;
352357
margin: 8px 0 8px 0;
353358
font-size: 17px;
359+
white-space: nowrap;
360+
line-height: 1;
354361
}
355362

356-
.breadcrumbs li.self-crumb {
363+
@media screen and (max-width: 768px) {
364+
.breadcrumbs {
365+
margin: 0 0 24px 0;
366+
}
367+
}
368+
369+
.self-crumb {
357370
color: #CFD8DC;
358371
}
359372

373+
nav .self-name {
374+
color: #CFD8DC;
375+
display: none;
376+
}
377+
360378
.annotation-list {
361379
list-style: none;
362380
padding: 0;
@@ -467,46 +485,67 @@ span.top-level-variable-type {
467485

468486
/* sidebar styles */
469487

470-
.sidebar-offcanvas h5 {
471-
margin-bottom: 16px;
488+
.sidebar-offcanvas-left {
489+
background-color: #f7f7f7;
472490
}
473491

474-
ol#sidebar {
492+
ol.sidebar {
475493
list-style: none;
476-
padding: 0;
494+
padding: 16px 0 16px 0;
477495
font-size: 14px;
478496
line-height: 24px;
479497
}
480498

481-
ol#sidebar li {
499+
ol.sidebar li {
482500
text-overflow: ellipsis;
483501
overflow: hidden;
484502
}
485503

486-
ol#sidebar li.section-title a {
504+
ol.sidebar li.section-title a {
487505
color: inherit;
488506
}
489507

490-
ol#sidebar li.section-title {
508+
ol.sidebar li.section-title {
491509
font-size: 12px;
492510
text-transform: uppercase;
493511
line-height: 20px;
494512
margin-top: 24px;
495513
}
496514

497-
ol#sidebar li:first-child {
515+
ol.sidebar li:first-child {
498516
padding-top: 0;
499517
margin-top: 0;
500518
}
501519

502-
#sidenav-toggle {
520+
button {
521+
padding: 0;
522+
}
523+
524+
#sidenav-left-toggle {
503525
display: none;
504526
vertical-align: text-bottom;
505527
padding: 0;
506528
}
507529

508-
@media screen and (max-width:767px) {
509-
#sidenav-toggle {
530+
#sidenav-right-toggle {
531+
display: inline;
532+
background: no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path fill='#FFFFFF' d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z'/></svg>");
533+
background-position: center;
534+
width: 24px;
535+
height: 24px;
536+
border: none;
537+
display: none;
538+
vertical-align: text-bottom;
539+
}
540+
541+
/* left-nav disappears, and can transition in from the left */
542+
@media screen and (max-width:768px) {
543+
.main-content {
544+
padding-left: 0;
545+
padding-right: 0;
546+
}
547+
548+
#sidenav-left-toggle {
510549
display: inline;
511550
background: no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path fill='#FFFFFF' d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z'/></svg>");
512551
background-position: center;
@@ -515,21 +554,55 @@ ol#sidebar li:first-child {
515554
border: none;
516555
margin-right: 24px;
517556
}
518-
.row-offcanvas {
519-
position:relative;
557+
558+
.sidebar-offcanvas-left {
559+
left:-100%;
560+
position:fixed;
520561
-webkit-transition:all .25s ease-out;
521562
-o-transition:all .25s ease-out;
522563
transition:all .25s ease-out;
564+
z-index: 2000;
565+
top:0;
566+
padding-left: 15px;
567+
width: 280px; /* works all the way down to an iphone 4 */
568+
height: 100%;
569+
background-color: white;
570+
overflow-y: auto; /* TODO: how to hide scroll bars? */
523571
}
524-
.row-offcanvas-right{right:0;}
525-
.row-offcanvas-left{left:0;}
526-
.row-offcanvas-right
527-
.sidebar-offcanvas{right:-50%;}
528-
.row-offcanvas-left
529-
.sidebar-offcanvas{left:-50%; margin-left: 16px;}
530-
.row-offcanvas-right.active{right:50%;}
531-
.row-offcanvas-left.active{left:50%;}
532-
.sidebar-offcanvas{position:absolute;top:0;width:50%;}
572+
573+
.sidebar-offcanvas-left.active {
574+
left:0; /* this animates our drawer into the page */
575+
}
576+
}
577+
578+
/* the right nav disappears out of view */
579+
/* THIS IS TOTALLY BROKEN... WILL REDO RIGHT-NAV */
580+
@media screen and (max-width: 992px) {
581+
.sidebar-offcanvas-right{
582+
right:-66%;
583+
position:fixed;
584+
-webkit-transition:all .25s ease-out;
585+
-o-transition:all .25s ease-out;
586+
transition:all .25s ease-out;
587+
z-index: 2000;
588+
top:0;
589+
width:50%;
590+
padding: 0;
591+
}
592+
593+
/* this mumbo jumbo disables scroll bars */
594+
.sidebar-offcanvas-right {
595+
overflow-y: auto;
596+
visibility: hidden;
597+
}
598+
599+
.sidebar-offcanvas-right ol {
600+
visibility: visible;
601+
background-color: white;
602+
}
603+
/* /insanity */
604+
605+
.sidebar-offcanvas-right.active{right:0;}
533606
}
534607

535608
/* source code method bodies */

lib/src/html_generator.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class Templates {
8888
'documentation',
8989
'name_summary',
9090
'sidebar_for_class',
91-
'source_code'
91+
'source_code',
92+
'sidebar_for_library'
9293
];
9394

9495
for (var partial in partials) {

lib/src/model.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,18 @@ class Package {
368368

369369
String get version => packageMeta.version;
370370

371+
bool get hasDocumentation =>
372+
documentationFile != null && documentationFile.contents.isNotEmpty;
373+
371374
bool get hasDocumentationFile => documentationFile != null;
372375

373376
FileContents get documentationFile => packageMeta.getReadmeContents();
374377

375378
// TODO: Clients should use [documentationFile] so they can act differently on
376379
// plain text or markdown.
377-
String get documentation =>
378-
hasDocumentationFile ? documentationFile.contents : null;
380+
String get documentation {
381+
return hasDocumentationFile ? documentationFile.contents : null;
382+
}
379383

380384
String get documentationAsHtml => renderMarkdownToHtml(documentation);
381385

lib/src/package_meta.dart

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ class FileContents {
4848
}
4949

5050
class _FilePackageMeta extends PackageMeta {
51+
FileContents _readme;
52+
FileContents _license;
53+
FileContents _changelog;
5154
Map _pubspec;
5255

5356
_FilePackageMeta(Directory dir) : super(dir) {
@@ -67,18 +70,24 @@ class _FilePackageMeta extends PackageMeta {
6770
String get homepage => _pubspec['homepage'];
6871

6972
FileContents getReadmeContents() {
70-
return new FileContents(
71-
_locate(dir, ['readme.md', 'readme.txt', 'readme']));
73+
if (_readme != null) return _readme;
74+
_readme =
75+
new FileContents(_locate(dir, ['readme.md', 'readme.txt', 'readme']));
76+
return _readme;
7277
}
7378

7479
FileContents getLicenseContents() {
75-
return new FileContents(
80+
if (_license != null) return _license;
81+
_license = new FileContents(
7682
_locate(dir, ['license.md', 'license.txt', 'license']));
83+
return _license;
7784
}
7885

7986
FileContents getChangelogContents() {
80-
return new FileContents(
87+
if (_changelog != null) return _changelog;
88+
_changelog = new FileContents(
8189
_locate(dir, ['changelog.md', 'changelog.txt', 'changelog']));
90+
return _changelog;
8291
}
8392
}
8493

@@ -89,12 +98,6 @@ File _locate(Directory dir, List<String> fileNames) {
8998
for (File f in files) {
9099
String baseName = path.basename(f.path).toLowerCase();
91100
if (baseName == name) return f;
92-
}
93-
}
94-
95-
for (String name in fileNames) {
96-
for (File f in files) {
97-
String baseName = path.basename(f.path).toLowerCase();
98101
if (baseName.startsWith(name)) return f;
99102
}
100103
}

0 commit comments

Comments
 (0)