Skip to content

Commit 131c556

Browse files
authored
update the css to match dartlang.org (#1416)
* refresh dartdoc css * regen testing package * review comments
1 parent ea56fcd commit 131c556

File tree

601 files changed

+5248
-6434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

601 files changed

+5248
-6434
lines changed

bin/dartdoc.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ main(List<String> arguments) async {
117117
}
118118

119119
PackageMeta packageMeta = sdkDocs
120-
? new PackageMeta.fromSdk(sdkDir, sdkReadmePath: readme)
120+
? new PackageMeta.fromSdk(sdkDir,
121+
sdkReadmePath: readme, useCategories: args['use-categories'])
121122
: new PackageMeta.fromDir(inputDir);
122123

123124
if (!packageMeta.isValid) {

lib/resources/styles.css

Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ html {
1616
}
1717

1818
body {
19-
font-family: 'Roboto', sans-serif;
20-
font-size: 15px;
21-
margin-bottom: 60px;
22-
-webkit-font-smoothing: antialiased;
2319
-webkit-text-size-adjust: 100%;
2420
overflow-x: hidden;
25-
color: #212121;
21+
22+
font-family: "Source Sans Pro", sans-serif;
23+
font-size: 16px;
24+
line-height: 1.42857143;
25+
color: #111111;
26+
background-color: #fff;
2627
}
2728

2829
nav {
@@ -51,13 +52,12 @@ nav .container {
5152
}
5253

5354
header {
54-
background-color: rgb(0, 102, 152);
55-
color: white;
56-
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37);
55+
background-color: #eeeeee;
56+
box-shadow: 0 3px 5px rgba(0,0,0,0.1);
5757
}
5858

5959
header.header-fixed nav.navbar-fixed-top {
60-
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37);
60+
box-shadow: 0 3px 5px rgba(0,0,0,0.1);
6161
}
6262

6363
header.container-fluid {
@@ -97,17 +97,25 @@ h3,
9797
h4,
9898
h5,
9999
h6 {
100-
font-weight: normal;
101-
margin: 0;
100+
font-family: "Source Sans Pro", sans-serif;
101+
font-weight: 400;
102+
margin-top: 1.5em;
103+
color: #111111;
102104
}
103105

104106
h1.title {
105107
overflow: hidden;
106108
text-overflow: ellipsis;
107109
}
108110

111+
h1 {
112+
font-size: 37px;
113+
margin-top: 0;
114+
margin-bottom: 0.67em;
115+
}
116+
109117
h2 {
110-
font-size: 24px;
118+
font-size: 28px;
111119
}
112120

113121
h5 {
@@ -134,18 +142,18 @@ p {
134142
}
135143

136144
a, a:hover {
137-
color: rgb(0, 102, 152);
145+
color: #1155cc;
138146
}
139147

140148
pre.prettyprint {
141149
font-family: 'Source Code Pro', monospace;
142150
color: black;
143-
border-radius: 4px;
144-
font-size: 14px;
151+
border-radius: 0;
152+
font-size: 15px;
145153
word-wrap: normal;
146154
line-height: 1.4;
147-
background: #f7f7f7;
148-
border: 1px solid #ddd;
155+
background: #eee;
156+
border: 0;
149157
margin: 16px 0 16px 0;
150158
padding: 8px;
151159
}
@@ -225,12 +233,11 @@ header a,
225233
header a:hover,
226234
header p,
227235
header li {
228-
color: white;
236+
color: #111;
229237
}
230238

231239
header h1 .kind {
232-
color: #ddd;
233-
text-transform: uppercase;
240+
color: #555;
234241
font-size: 15px;
235242
display: block;
236243
}
@@ -261,10 +268,6 @@ dd p {
261268
}
262269

263270
section.summary h2 {
264-
color: #727272;
265-
margin-bottom: 16px;
266-
padding-bottom: 4px;
267-
border-bottom: 1px solid #ddd;
268271
}
269272

270273
/* indents wrapped lines */
@@ -326,16 +329,16 @@ p.firstline {
326329
}
327330

328331
footer {
332+
color: #fff;
333+
line-height: 16px;
334+
background-color: #111111;
329335
padding: 20px;
330-
position: absolute;
331-
bottom: 0;
332336
width: 100%;
333-
height: 60px;
337+
margin: 20px 0 0 0;
334338
}
335339

336340
footer p {
337341
margin: 0;
338-
color: #555;
339342
}
340343

341344
footer .no-break {
@@ -348,8 +351,8 @@ footer .container-fluid {
348351
padding-right: 0;
349352
}
350353

351-
.copyright a {
352-
color: #555;
354+
footer a, footer a:hover {
355+
color: #fff;
353356
}
354357

355358
.markdown h1 {
@@ -443,7 +446,7 @@ footer .container-fluid {
443446
}
444447

445448
.self-crumb {
446-
color: #ddd;
449+
color: #555;
447450
}
448451

449452
nav .self-name {
@@ -510,7 +513,7 @@ ul.subnav li {
510513
}
511514

512515
ul.subnav li a {
513-
color: #FFFFFF;
516+
color: #111;
514517
}
515518

516519
ul.subnav li {
@@ -529,39 +532,49 @@ ul.subnav li:last-of-type {
529532

530533
/* sidebar styles */
531534

532-
.sidebar-offcanvas-left {
533-
background-color: #f7f7f7;
535+
.sidebar-offcanvas-left,
536+
.sidebar-offcanvas-right {
534537
padding: 0;
535538
}
536539

537540
.sidebar ol {
538541
list-style: none;
539-
font-size: 14px;
540-
line-height: 24px;
542+
line-height: 22px;
541543
margin-bottom: 0;
542544
padding: 0;
543545
}
544546

545547
.sidebar-offcanvas-left ol {
546-
padding: 16px;
548+
}
549+
550+
.sidebar h5 {
551+
color: #727272;
552+
font-size: 18px;
553+
margin: 0 0 25px 0;
554+
white-space: nowrap;
555+
}
556+
557+
.sidebar h5 a,
558+
.sidebar h5 a:hover {
559+
color: #727272;
547560
}
548561

549562
.sidebar h5,
550563
.sidebar ol li {
551564
text-overflow: ellipsis;
552565
overflow: hidden;
566+
padding: 3px 0;
553567
}
554568

555569
.sidebar ol li.section-title a {
556570
color: inherit;
557571
}
558572

559573
.sidebar ol li.section-title {
560-
font-size: 13px;
561-
color: #B6B6B6;
574+
font-size: 18px;
575+
font-weight: normal;
562576
text-transform: uppercase;
563-
line-height: 20px;
564-
margin-top: 24px;
577+
padding-top: 25px;
565578
}
566579

567580
.sidebar ol li:first-child {
@@ -605,42 +618,36 @@ button {
605618
}
606619

607620
.sidebar-offcanvas-left {
608-
left:-100%;
609-
position:fixed;
621+
left: -100%;
622+
position: fixed;
610623
-webkit-transition:all .25s ease-out;
611624
-o-transition:all .25s ease-out;
612625
transition:all .25s ease-out;
613626
z-index: 2000;
614-
top:0;
627+
top: 0;
615628
width: 280px; /* works all the way down to an iphone 4 */
616629
height: 100%;
617630
background-color: white;
618631
overflow-y: auto; /* TODO: how to hide scroll bars? */
619632
}
620633

621634
.sidebar-offcanvas-left.active {
622-
left:0; /* this animates our drawer into the page */
635+
left: 0; /* this animates our drawer into the page */
623636
}
624637
}
625638

626-
.sidebar h5 {
627-
color: #727272;
628-
padding-bottom: 16px;
629-
}
630-
631639
.sidebar-offcanvas-left h5 {
632-
border-bottom: 1px solid #ddd;
633-
padding: 16px;
640+
margin-bottom: 10px;
634641
}
635642

636643
.sidebar-offcanvas-left h5:last-of-type {
637644
border: 0;
638-
padding: 16px 16px 0 16px;
645+
margin-bottom: 25px;
639646
}
640647

641648
/* the right nav disappears out of view when the window shrinks */
642649
@media screen and (max-width: 992px) {
643-
.sidebar-offcanvas-right{
650+
.sidebar-offcanvas-right {
644651
display: none;
645652
}
646653
}
@@ -742,6 +749,10 @@ form.search {
742749
color: gray;
743750
}
744751

752+
#search-box {
753+
background-color: #ffffff;
754+
}
755+
745756
section#setter {
746757
border-top: 1px solid #ddd;
747758
padding-top: 36px;

lib/src/html/template_data.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ abstract class TemplateData<T extends Documentable> {
3232
String get title;
3333
String get layoutTitle;
3434
String get metaDescription;
35+
String get name => self.name;
36+
String get kind => self is ModelElement ? (self as ModelElement).kind : null;
37+
3538
List get navLinks;
39+
Documentable get parent => navLinks.isNotEmpty ? navLinks.last : null;
40+
3641
bool get includeVersion => false;
3742

3843
bool get hasSubNav => subnavItems.isNotEmpty;
@@ -83,8 +88,7 @@ class PackageTemplateData extends TemplateData<Package> {
8388
@override
8489
Package get self => package;
8590
@override
86-
String get layoutTitle => _layoutTitle(
87-
package.name, (useCategories || package.isSdk) ? '' : 'package', false);
91+
String get layoutTitle => _layoutTitle(package.name, kind, false);
8892
@override
8993
String get metaDescription =>
9094
'${package.name} API docs, for the Dart programming language.';
@@ -93,6 +97,9 @@ class PackageTemplateData extends TemplateData<Package> {
9397
return [new Subnav('Libraries', '${package.href}#libraries')];
9498
}
9599

100+
@override
101+
String get kind => (useCategories || package.isSdk) ? '' : 'package';
102+
96103
/// `null` for packages because they are at the root – not needed
97104
@override
98105
String get htmlBase => null;

lib/src/model.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ class Constructor extends ModelElement
896896
/// Bridges the gap between model elements and packages,
897897
/// both of which have documentation.
898898
abstract class Documentable implements Warnable {
899+
String get name;
899900
String get documentation;
900901
String get documentationAsHtml;
901902
bool get hasDocumentation;
@@ -2432,8 +2433,8 @@ abstract class ModelElement implements Comparable, Nameable, Documentable {
24322433
return HTML_ESCAPE.convert(name);
24332434
}
24342435

2435-
var classContent = isDeprecated ? 'class="deprecated" ' : '';
2436-
return '<a ${classContent}href="${href}">$name</a>';
2436+
var classContent = isDeprecated ? ' class="deprecated"' : '';
2437+
return '<a${classContent} href="${href}">$name</a>';
24372438
}
24382439

24392440
// TODO(keertip): consolidate all the find library methods
@@ -3240,6 +3241,9 @@ class Package implements Nameable, Documentable {
32403241
@override
32413242
String get name => packageMeta.name;
32423243

3244+
String get kind =>
3245+
(packageMeta.useCategories || package.isSdk) ? '' : 'package';
3246+
32433247
@override
32443248
String get oneLineDoc => '';
32453249

lib/src/package_meta.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ import 'package:yaml/yaml.dart';
1111

1212
abstract class PackageMeta {
1313
final Directory dir;
14+
final bool useCategories;
1415

15-
PackageMeta(this.dir);
16+
PackageMeta(this.dir, {this.useCategories: false});
1617

1718
factory PackageMeta.fromDir(Directory dir) => new _FilePackageMeta(dir);
18-
factory PackageMeta.fromSdk(Directory sdkDir, {String sdkReadmePath}) =>
19-
new _SdkMeta(sdkDir, sdkReadmePath: sdkReadmePath);
19+
factory PackageMeta.fromSdk(Directory sdkDir,
20+
{String sdkReadmePath, bool useCategories}) =>
21+
new _SdkMeta(sdkDir,
22+
sdkReadmePath: sdkReadmePath, useCategories: useCategories);
2023

2124
bool get isSdk;
2225
bool get needsPubGet => false;
@@ -180,7 +183,8 @@ File _locate(Directory dir, List<String> fileNames) {
180183
class _SdkMeta extends PackageMeta {
181184
final String sdkReadmePath;
182185

183-
_SdkMeta(Directory dir, {this.sdkReadmePath}) : super(dir);
186+
_SdkMeta(Directory dir, {this.sdkReadmePath, bool useCategories})
187+
: super(dir, useCategories: useCategories);
184188

185189
@override
186190
bool get isSdk => true;

lib/templates/_footer.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
</span>
1111
&bull;
1212
<span class="no-break">
13-
<a href="https://www.dartlang.org">
14-
<img src="static-assets/favicon.png" alt="Dart" title="Dart" width="16" height="16">
15-
</a>
13+
<a href="https://www.dartlang.org"><img src="static-assets/favicon.png" alt="Dart" title="Dart" width="16" height="16"></a>
1614
</span>
1715
&bull;
1816
<span class="copyright no-break">

0 commit comments

Comments
 (0)