Skip to content

Commit a5a97d1

Browse files
authored
Simplify styles used on Effective Dart pages (#6352)
This PR eliminates the usages of bootstrap by styles added for Effective Dart. Also completes some nearby/related cleanup. No (large) functional change. Contributes to #4164
1 parent 35beac6 commit a5a97d1

File tree

5 files changed

+25
-35
lines changed

5 files changed

+25
-35
lines changed

src/_sass/_overwrites.scss

-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'sass:color';
22

33
@use 'core/variables' as *;
4-
@use 'core/bootstrap';
54

65
/* Add space between definitions. */
76
dd {
@@ -28,16 +27,6 @@ a {
2827
color: white;
2928
}
3029

31-
/* Effective Dart TOC */
32-
33-
.effective_dart--summary_column {
34-
@include bootstrap.media-breakpoint-up(md) {
35-
width: 50%;
36-
float: left;
37-
padding-right: 5%;
38-
}
39-
}
40-
4130
@media print {
4231
/* Don't display navigation aids when printing */
4332
#page-header, #sidenav, #subnav, #page-footer, .banner,
@@ -72,9 +61,3 @@ a {
7261
pre code {
7362
white-space: pre;
7463
}
75-
76-
/* Effective Dart linter rules */
77-
.linter-rule {
78-
font-size: smaller;
79-
font-style: italic;
80-
}

src/_sass/_site.scss

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
@use 'core/bootstrap';
66
@use 'core/base';
7+
@use 'core/utils';
78

89
@use 'components/banner';
910
@use 'components/card';
@@ -387,6 +388,13 @@ main .content {
387388
}
388389
}
389390

391+
// Callouts for related lints in Effective Dart guidelines.
392+
.linter-rule {
393+
margin-block-start: -0.375rem;
394+
font-size: 0.9em;
395+
font-style: italic;
396+
}
397+
390398
.list-image {
391399
width: 48px;
392400
margin: 0.25rem;

src/_sass/core/_utils.scss

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.side-by-side {
2+
display: grid;
3+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
4+
column-gap: 2rem;
5+
row-gap: 0;
6+
justify-content: center;
7+
}

src/content/effective-dart/_toc.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ the project:
77
./dash_site effective-dart
88
```
99
{% endcomment %}
10-
11-
<div class='effective_dart--summary_column'>
10+
11+
<div class="side-by-side"><div>
1212

1313
### Style
1414

@@ -42,7 +42,7 @@ the project:
4242
* <a href='/effective-dart/style#do-use-curly-braces-for-all-flow-control-statements'>DO use curly braces for all flow control statements.</a>
4343

4444
</div>
45-
<div class='effective_dart--summary_column'>
45+
<div>
4646

4747

4848
### Documentation
@@ -85,8 +85,7 @@ the project:
8585
* <a href='/effective-dart/documentation#prefer-using-this-instead-of-the-to-refer-to-a-members-instance'>PREFER using &quot;this&quot; instead of &quot;the&quot; to refer to a member's instance.</a>
8686

8787
</div>
88-
<div style='clear:both'></div>
89-
<div class='effective_dart--summary_column'>
88+
<div>
9089

9190

9291
### Usage
@@ -166,7 +165,7 @@ the project:
166165
* <a href='/effective-dart/usage#do-test-for-futuret-when-disambiguating-a-futureort-whose-type-argument-could-be-object'>DO test for <code>Future&lt;T&gt;</code> when disambiguating a <code>FutureOr&lt;T&gt;</code> whose type argument could be <code>Object</code>.</a>
167166

168167
</div>
169-
<div class='effective_dart--summary_column'>
168+
<div>
170169

171170

172171
### Design
@@ -258,4 +257,4 @@ the project:
258257
* <a href='/effective-dart/design#dont-make-the-parameter-to-nullable'>DON'T make the parameter to <code>==</code> nullable.</a>
259258

260259
</div>
261-
<div style='clear:both'></div>
260+
</div>

tool/dart_site/lib/src/commands/generate_effective_dart_toc.dart

+4-11
Original file line numberDiff line numberDiff line change
@@ -78,27 +78,20 @@ the project:
7878
./dash_site effective-dart
7979
```
8080
{% endcomment %}
81-
''');
81+
''');
8282

83-
newOutput.writeln(
84-
r"<div class='effective_dart--summary_column'>",
85-
);
83+
newOutput.writeln(r'<div class="side-by-side"><div>');
8684

8785
for (var sectionIndex = 0; sectionIndex < sections.length; sectionIndex++) {
8886
final section = sections[sectionIndex];
8987
if (sectionIndex > 0) {
90-
if (sectionIndex.isEven) {
91-
newOutput.writeln("<div style='clear:both'></div>");
92-
}
93-
newOutput.writeln(
94-
"<div class='effective_dart--summary_column'>\n",
95-
);
88+
newOutput.writeln('<div>\n');
9689
}
9790
_writeSection(newOutput, section);
9891
newOutput.writeln('\n</div>');
9992
}
10093

101-
newOutput.writeln("<div style='clear:both'></div>");
94+
newOutput.writeln('</div>');
10295

10396
final tocFile = File(path.join(dirPath, '_toc.md'));
10497
try {

0 commit comments

Comments
 (0)