Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: runtime/observatory/lib/src/elements/nav/notify_wrapper.dart

Issue 2167053002: Converted Observatory nav-notify element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed template ciclic references that were blocking initialization Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:html';
6
7 import 'package:observatory/app.dart';
8 import 'package:observatory/repositories.dart';
9 import 'package:observatory/src/elements/helpers/tag.dart';
10 import 'package:observatory/src/elements/shims/binding.dart';
11 import 'package:observatory/src/elements/nav/notify.dart';
12
13 class NavNotifyElementWrapper extends HtmlElement {
14 static final binder = new Binder<NavNotifyElementWrapper>(
15 const [const Binding('notifications'), const Binding('notifyOnPause')]);
16
17 static const tag = const Tag<NavNotifyElementWrapper>('nav-notify');
18
19 NotificationRepository _notifications;
20 bool _notifyOnPause = true;
21 NotificationRepository get notifications => _notifications;
22 bool get notifyOnPause => _notifyOnPause;
23 set notifications(NotificationRepository value) {
24 _notifications = value; render();
25 }
26 set notifyOnPause(bool value) {
27 _notifyOnPause = value; render();
28 }
29
30 NavNotifyElementWrapper.created() : super.created() {
31 binder.registerCallback(this);
32 createShadowRoot();
33 render();
34 }
35
36 @override
37 void attached() {
38 super.attached();
39 render();
40 }
41
42 void render() {
43 shadowRoot.children = [];
44 if (_notifications == null) return;
45
46 shadowRoot.children = [
47 new StyleElement()
48 ..text = '''nav-notify-wrapped > div {
49 float: right;
50 }
51 nav-notify-wrapped > div > div {
52 display: block;
53 position: absolute;
54 top: 98%;
55 right: 0;
56 margin: 0;
57 padding: 0;
58 width: auto;
59 z-index: 1000;
60 background: none;
61 }
62
63 /* nav-exception & nav-event */
64
65 nav-exception > div, nav-event > div {
66 position: relative;
67 padding: 16px;
68 margin-top: 10px;
69 margin-right: 10px;
70 padding-right: 25px;
71 width: 500px;
72 color: #ddd;
73 background: rgba(0,0,0,.6);
74 border: solid 2px white;
75 box-shadow: 0 0 5px black;
76 border-radius: 5px;
77 animation: fadein 1s;
78 }
79
80 nav-exception *, nav-event * {
81 color: #ddd;
82 font-size: 12px;
83 }
84
85 nav-exception > div > a, nav-event > div > a {
86 color: white;
87 text-decoration: none;
88 }
89
90 nav-exception > div > a:hover, nav-event > div > a:hover {
91 text-decoration: underline;
92 }
93
94 nav-exception > div > div {
95 margin-left:20px;
96 white-space: pre
97 }
98
99 nav-exception > div > button, nav-event > div > button {
100 background: transparent;
101 border: none;
102 position: absolute;
103 display: block;
104 top: 4px;
105 right: 4px;
106 height: 18px;
107 width: 18px;
108 line-height: 16px;
109 border-radius: 9px;
110 color: white;
111 font-size: 18px;
112 cursor: pointer;
113 text-align: center;
114 }
115
116 nav-exception > div > button:hover, nav-event > div > button:hover {
117 background: rgba(255,255,255,0.5);
118 }''',
119 new NavNotifyElement(_notifications, notifyOnPause: notifyOnPause,
120 queue: ObservatoryApplication.app.queue)
121 ];
122 }
123 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/notify_exception.dart ('k') | runtime/observatory/lib/src/elements/nav_bar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698