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

Side by Side Diff: sky/examples/widgets/index.sky

Issue 946813005: Port Sky widgets demo to Dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « sky/engine/core/dom/Element.idl ('k') | sky/examples/widgets/widget-root.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!mojo mojo:sky_viewer 1 #!mojo mojo:sky_viewer
2 <!-- 2 <!--
3 // Copyright 2014 The Chromium Authors. All rights reserved. 3 // Copyright 2015 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 --> 6 -->
7 <sky> 7 <import src="widget-root.sky"/>
8 <import src="/sky/framework/sky-box.sky"/>
9 <import src="/sky/framework/sky-button.sky"/>
10 <import src="/sky/framework/sky-checkbox.sky"/>
11 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement"/>
12 <import src="/sky/framework/sky-input.sky"/>
13 <import src="/sky/framework/sky-radio.sky"/>
14 <sky-element name="widget-root">
15 <template>
16 <style>
17 div {
18 display: flex;
19 align-items: center;
20 }
21 sky-checkbox {
22 margin: 5px;
23 }
24 .output {
25 margin-left: 48px;
26 }
27 </style>
28
29 <sky-box title='Text'>
30 <sky-input id="text" value="{{ inputValue }}" />
31 <div>value = {{ inputValue }}</div>
32 </sky-box>
33
34 <sky-box title='Buttons'>
35 <sky-button id='button' on-click='handleClick'>Button</sky-button>
36 <div>highlight: {{ myButton.highlight }}</div>
37 <div>clickCount: {{ clickCount }}</div>
38 </sky-box>
39
40 <sky-box title='Checkboxes'>
41 <div><sky-checkbox id='checkbox' checked='{{ checked }}'/>Checkbox</div>
42 <div class="output">highlight: {{ myCheckbox.highlight }}</div>
43 <div class="output">checked: {{ myCheckbox.checked }}</div>
44 <div><sky-checkbox id='checkbox' checked="true"/>Checkbox, default checked.< /div>
45 <div class="output">checked: {{ checked }}</div>
46 </sky-box>
47
48 <sky-box title='Radios'>
49 <sky-box title='Group One'>
50 <div><sky-radio group='foo'/>one</div>
51 <div><sky-radio group='foo' selected='true' />two</div>
52 <div><sky-radio group='foo'/>three</div>
53 </sky-box>
54 <sky-box title='Group Two'>
55 <div><sky-radio group='bar'/>A</div>
56 <div><sky-radio group='bar'/>B</div>
57 <div><sky-radio group='bar' selected='true' />C</div>
58 </sky-box>
59 </sky-box>
60
61 </template>
62 <script>
63 module.exports = class extends SkyElement {
64 created() {
65 this.myButton = null;
66 this.myCheckbox = null;
67 this.myText = null;
68 this.clickCount = 0;
69 this.inputValue = "Ready";
70 this.checked = false;
71 }
72 attached() {
73 this.myButton = this.shadowRoot.getElementById('button');
74 this.myCheckbox = this.shadowRoot.getElementById('checkbox');
75 this.myText = this.shadowRoot.getElementById('text');
76 this.clickCount = 0;
77 }
78 handleClick(event) {
79 this.clickCount++;
80 this.checked = !this.checked;
81 this.inputValue = "Moar clicking " + this.clickCount;
82 }
83 }.register();
84 </script>
85 </sky-element>
86
87 <widget-root /> 8 <widget-root />
88 </sky>
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Element.idl ('k') | sky/examples/widgets/widget-root.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698