Skip to content

Commit cfedb51

Browse files
authored
Improve banner CSS (#8092)
* Improve banner CSS * On standalone pages the banner will sit in page and be hidden. * On package page (and landing page) the banner will float over content with position absolute, as these pages have sufficient margin to allow for this. In both cases content will not jump when the banner is dismissed, or when the banner is loaded. * Fix tests * Fix tests * Inline the banner at all times
1 parent 73c20ff commit cfedb51

File tree

4 files changed

+9
-22
lines changed

4 files changed

+9
-22
lines changed

app/test/frontend/static_files_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ void main() {
212212
test('script.dart.js and parts size check', () {
213213
final file = cache.getFile('/static/js/script.dart.js');
214214
expect(file, isNotNull);
215-
expect((file!.bytes.length / 1024).round(), closeTo(333, 2));
215+
expect((file!.bytes.length / 1024).round(), closeTo(336, 20));
216216

217217
final parts = cache.paths
218218
.where((path) =>
219219
path.startsWith('/static/js/script.dart.js') &&
220220
path.endsWith('part.js'))
221221
.toList();
222-
expect(parts.length, closeTo(17, 3));
222+
expect(parts.length, closeTo(15, 5));
223223
final partsSize = parts
224224
.map((p) => cache.getFile(p)!.bytes.length)
225225
.reduce((a, b) => a + b);

pkg/web_app/lib/src/widget/widget.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:web/web.dart';
1010

1111
import '../web_util.dart';
1212
import 'completion/widget.dart' deferred as completion;
13-
import 'switch/widget.dart' deferred as switch_;
13+
import 'switch/widget.dart' as switch_;
1414

1515
/// Function to create an instance of the widget given an element and options.
1616
///
@@ -32,7 +32,7 @@ typedef _WidgetLoaderFn = FutureOr<_WidgetFn> Function();
3232
/// Map from widget name to widget loader
3333
final _widgets = <String, _WidgetLoaderFn>{
3434
'completion': () => completion.loadLibrary().then((_) => completion.create),
35-
'switch': () => switch_.loadLibrary().then((_) => switch_.create),
35+
'switch': () => switch_.create,
3636
};
3737

3838
Future<_WidgetFn> _noSuchWidget() async =>

pkg/web_app/test/deferred_import_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ void main() {
3636
'lib/src/deferred/markdown.dart',
3737
],
3838
'completion/': [],
39-
'dismiss/': [],
40-
'switch/': [],
4139
};
4240

4341
for (final file in files) {

pkg/web_css/lib/src/_base.scss

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -393,31 +393,20 @@ pre {
393393
text-align: center;
394394

395395
.dismisser {
396-
float: right;
396+
position: absolute;
397+
display: inline-block;
398+
right: 0px;
397399
padding: 5px 15px;
398400
margin-top: -5px;
399401
cursor: pointer;
400402
user-select: none;
401403
}
402404

403405
&.dismissed {
404-
visibility: hidden;
405-
}
406-
407-
z-index: 0;
408-
animation-duration: 200ms;
409-
animation-name: slide-down;
410-
animation-timing-function: ease;
411-
}
412-
413-
@keyframes slide-down {
414-
from {
415-
translate: 0 -100%;
406+
display: none;
416407
}
417408

418-
to {
419-
translate: 0 0;
420-
}
409+
z-index: 1000;
421410
}
422411

423412
a.-x-ago {

0 commit comments

Comments
 (0)