This repository has been archived by the owner on Apr 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 222
/
components.html
730 lines (623 loc) · 33.1 KB
/
components.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
---
layout: default
---
<nav class="action-bar fixed-bottom docs-footer">
<ul>
<li><a data-ignore="true" class="twitter-share-button" href="https://twitter.com/share" data-url="http://jaunesarmiento.me/fries/" data-text="Fries v{{ site.version }}: Create sexy #Android UI using #HTML, #CSS, and #JavaScript." data-via="getfries">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</li>
<li>
<a data-ignore="true" class="twitter-follow-button" href="https://twitter.com/getfries" data-show-count="true">Follow @getfries</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</li>
<li>
<iframe width="107" height="20" src="http://ghbtns.com/github-btn.html?user=jaunesarmiento&repo=fries&type=watch&count=true" frameborder="0" scrolling="0" allowtransparency="true"></iframe>
</li>
<li>
<iframe width="95" height="20" src="http://ghbtns.com/github-btn.html?user=jaunesarmiento&repo=fries&type=fork&count=true" frameborder="0" scrolling="0" allowtransparency="true"></iframe>
</li>
<li>
<a href="https://news.ycombinator.com/submit" class="hn-button" data-title="Fries" data-url="http://jaunesarmiento.me/fries/" data-count="horizontal" data-style="twitter">Vote on Hacker News</a>
<script type="text/javascript">var HN=[];HN.factory=function(e){return function(){HN.push([e].concat(Array.prototype.slice.call(arguments,0)))};},HN.on=HN.factory("on"),HN.once=HN.factory("once"),HN.off=HN.factory("off"),HN.emit=HN.factory("emit"),HN.load=function(){var e="hn-button.js";if(document.getElementById(e))return;var t=document.createElement("script");t.id=e,t.src="//hn-button.herokuapp.com/hn-button.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)},HN.load();</script>
</li>
</ul>
</nav>
<div class="docs-sidebar">
<ul class="list inset">
<li class="list-divider">Components</li>
<li class="list-item-single-line selectable"><a href="#action-bars">Action Bars</a></li>
<li class="list-item-single-line selectable"><a href="#tabs">Tabs</a></li>
<li class="list-item-single-line selectable"><a href="#buttons">Buttons</a></li>
<li class="list-item-single-line selectable"><a href="#spinners" data-ignore="true">Spinners</a></li>
<li class="list-item-single-line selectable"><a href="#lists">Lists</a></li>
<li class="list-item-single-line selectable"><a href="#forms">Forms</a></li>
<li class="list-item-single-line selectable"><a href="#dialogs">Dialogs</a></li>
<li class="list-item-single-line selectable"><a href="#toasts">Toast Notifications</a></li>
<li class="list-item-single-line selectable"><a href="#helpers">Helpers</a></li>
<li class="list-item-single-line selectable"><a href="#stack-js">Stack.js</a></li>
</ul>
</div>
<div class="docs-content inner-content">
<article id="components" class="content-section">
<div class="section-header">
<h2 class="section-title">Components</h2>
<p class="section-description">UI building blocks</p>
</div>
<section id="action-bars" class="component">
<h3 class="component-title">Action bars</h3>
<p class="component-description">Action bars serve as your main navigation throughout your app. These hold the app icon, app title, action buttons, and can also hold tabs.</p>
<p class="component-description">App icons must be 32px in height. It can have any width though as long as your prototype doesn't break its layout.</p>
<div class="component-example">
<header class="action-bar">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h1 class="title">Title</h1>
</header>
</div>
<pre class="prettyprint">
<header class="action-bar">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h1 class="title">Title</h1>
</header>
</pre>
</section>
<section id="action-bar-with-up-button" class="component">
<h3 class="component-title">Action bar with Up button</h3>
<p class="component-description">Adding the Up button means that the current screen is not at the top level. The data attribute <code>data-transition="pop"</code> tells Fries that when this button is pressed, the browser's history stack is popped, taking the user back to the previous page or whatever is in the <code>href</code>.</p>
<div class="component-example">
<header class="action-bar">
<a href="javascript: void(0)" class="app-icon action up" data-transition="pop">
<i class="icon-up-button"></i>
<i class="icon-fries"></i>
</a>
<h1 class="title">Title</h1>
</header>
</div>
<pre class="prettyprint">
<header class="action-bar">
<a href="javascript: void(0);" class="app-icon action up" data-transition="pop">
<i class="icon-up-button"></i>
<i class="icon-fries"></i>
</a>
<h1 class="title">Title</h1>
</header>
</pre>
</section>
<section id="action-bar-with-subtitle" class="component">
<h3 class="component-title">Action bar with subtitles</h3>
<p class="component-description">You can also create an action bar with a title and a subtitle</p>
<div class="component-example">
<header class="action-bar">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h2 class="title">Title <span class="subtitle">Subtitle</span></h2>
</header>
</div>
<pre class="prettyprint">
<header class="action-bar">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h2 class="title">Title <span class="subtitle">Subtitle</span></h2>
</header>
</pre>
</section>
<section id="action-buttons" class="component">
<h3 class="component-title">Action buttons</h3>
<p class="component-description">Action bars can also have buttons in them.</p>
<div class="component-example">
<header class="action-bar fixed-top">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h1 class="title">Action Buttons</h1>
<ul class="actions pull-right">
<li><a href="javascript: void(0);" class="action" title="Search"><i class="icon-search"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Settings"><i class="icon-settings"></i></a></li>
</ul>
</header>
</div>
<pre class="prettyprint">
<header class="action-bar fixed-top">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h1 class="title">Action Buttons</h1>
<ul class="actions pull-right">
<li><a href="javascript: void(0);" class="action" title="Search"><i class="icon-search"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Settings"><i class="icon-settings"></i></a></li>
</ul>
</header>
</pre>
</section>
<section id="action-overflows" class="component">
<h3 class="component-title">Action overflows</h3>
<p class="component-description">Currently, in Fries, you can only add a maximum of two (2) action buttons to the action bar when the device width is less than 480 pixels (<em>which will most likely change in future updates to follow the official Android rules for setting overflows</em>) and you have an app icon and title. This is where action overflows come in.</p>
<p class="component-description">Action overflows automatically convert action buttons into a <a href="#spinners" class="open-link">Spinner</a> when there are more than two buttons in your action bar. Fries will automatically use the value of the button's <code>title</code> attribute to generate a Spinner item. So make sure that you add a <code>title</code> to your action buttons.</p>
<div class="component-example">
<header class="action-bar fixed-top">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h1 class="title">Action Overflows</h1>
<ul class="actions pull-right">
<li><a href="javascript: void(0);" class="action" title="Search"><i class="icon-search"></i></a></li>
<li class="action-overflow-docs">
<a class="action action-overflow-icon toggle-spinner"><i></i></a>
<ol reversed="reversed" class="action-overflow-list spinner">
<li class="spinner-item"><a href="javascript: void(0);" data-transition="null" data-timeout="null" data-ignore="null">Settings</a></li>
<li class="spinner-item"><a href="javascript: void(0);" data-transition="null" data-timeout="null" data-ignore="null">Cut</a></li>
<li class="spinner-item"><a href="javascript: void(0);" data-transition="null" data-timeout="null" data-ignore="null">Copy</a></li>
</ol>
</li>
</ul>
</header>
</div>
<pre class="prettyprint">
<header class="action-bar fixed-top">
<a href="javascript: void(0);" class="app-icon action">
<i class="icon-fries"></i>
</a>
<h1 class="title">Action Buttons</h1>
<ul class="actions pull-right">
<li><a href="javascript: void(0);" class="action" title="Search"><i class="icon-search"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Copy"><i class="icon-copy"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Cut"><i class="icon-cut"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Settings"><i class="icon-settings"></i></a></li>
</ul>
</header>
</pre>
</section>
<section id="action-bars-fixed-bottom" class="component">
<h3 class="component-title">Bottom-fixed action bars</h3>
<p class="component-description">You can also fix your action bars at the bottom of the page by adding <code>.fixed-bottom</code> class to your action bars.</p>
<pre class="prettyprint">
<nav class="action-bar fixed-bottom">
<ul class="actions flex">
<li><a href="javascript: void(0);" class="action" title="Map"><i class="icon-location-marker"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Calendar"><i class="icon-calendar"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Dial"><i class="icon-dial"></i></a></li>
<li><a href="javascript: void(0);" class="action" title="Hang up"><i class="icon-hang-up"></i></a></li>
</ul>
</nav>
</pre>
</section>
<section id="tabs" class="component">
<h3 class="component-title">Tabs</h3>
<p class="component-description">Tabs are usually used to navigate between multiple screens.</p>
<p class="component-description">The following example is rendered by the code below it.</p>
<div class="component-example">
<nav class="tab-fixed">
<ul class="tab-inner">
<li class="active"><a href="#item1" data-ignore="true">Tab 1</a></li>
<li><a href="#item2" data-ignore="true">Tab 2</a></li>
<li><a href="#item3" data-ignore="true">Tab 3</a></li>
</ul>
</nav>
</div>
<pre class="prettyprint">
<nav class="tab-fixed">
<ul class="tab-inner">
<li class="active"><a href="#item1" data-ignore="true">Tab 1</a></li>
<li><a href="#item2" data-ignore="true">Tab 2</a></li>
<li><a href="#item3" data-ignore="true">Tab 3</a></li>
</ul>
</nav>
</pre>
<p class="component-description">The content that slides when a tab is clicked should follow the following markup. Notice that the <code>href</code> attributes of the tabs above match the <code>id</code> attributes of each <code>.tab-item</code>.</p>
<pre class="prettyprint">
<div class="content">
<div class="slider">
<ul>
<li id="item1" class="tab-item active">
<!-- Any content can go here -->
<div class="inset">
<p>Item 1</p>
</div>
</li>
<li id="item2" class="tab-item">
<!-- Any content can go here -->
<div class="inset">
<p>Item 2</p>
</div>
</li>
<li id="item3" class="tab-item">
<!-- Any content can go here -->
<div class="inset">
<p>Item 3</p>
</li>
</ul>
</div>
</div>
</pre>
</section>
<section id="buttons" class="component">
<h3 class="component-title">Buttons</h3>
<p class="component-description">Buttons come in two sizes and supports all button states.</p>
<div class="component-example">
<div class="black-bg inset">
<button class="btn">Normal</button>
<button class="btn-small">Small</button>
<button class="btn focused">Focused Normal</button>
<button class="btn-small focused">Focused Small</button>
<button class="btn active">Pressed Normal</button>
<button class="btn-small active">Pressed Small</button>
<button class="btn focused" disabled>Focused Disabled</button>
<button class="btn-small focused" disabled>Focused Disabled Small</button>
<button class="btn" disabled>Disabled</button>
<button class="btn-small" disabled>Disabled Small</button>
</div>
</div>
<pre class="prettyprint">
<button class="btn">Normal</button>
<button class="btn-small">Small</button>
<button class="btn focused">Focused Normal</button>
<button class="btn-small focused">Focused Small</button>
<button class="btn active">Pressed Normal</button>
<button class="btn-small active">Pressed Small</button>
<button class="btn focused" disabled>Focused Disabled</button>
<button class="btn-small focused" disabled>Focused Disabled Small</button>
<button class="btn" disabled>Disabled</button>
<button class="btn-small" disabled>Disabled Small</button>
</pre>
</section>
<section id="spinners" class="component">
<h3 class="component-title">Spinners</h3>
<p class="component-description">Spinners come in handy when you want to save up on horizontal real estate and works like a dropdown UI component. Currently, Fries does not change the value of the selected spinner item. It's up to you to do that for now.</p>
<div class="component-example">
<div class="black-bg">
<form class="form-flex inset">
<label class="block-label">Address</label>
<div class="flex-group">
<input type="text" placeholder="Address" class="input-text flex2">
<div class="form-spinner">
<a href="javascript: void(0);" class="toggle-spinner">Home</a>
<ul class="spinner">
<li class="spinner-item"><a href="javascript: void(0);">Work</a></li>
<li class="spinner-item"><a href="javascript: void(0);">Secondary</a></li>
</ul>
</div>
</div>
</form>
</div>
</div>
<pre class="prettyprint">
<div class="form-spinner">
<a href="javascript: void(0);" class="toggle-spinner">Home</a>
<ul class="spinner">
<li class="spinner-item"><a href="javascript: void(0);">Work</a></li>
<li class="spinner-item"><a href="javascript: void(0);">Secondary</a></li>
</ul>
</div>
</pre>
<p class="component-description">An <a href="#action-overflows" class="open-link">action overflow</a> is also an example of a spinner.</p>
</section>
<section id="lists" class="component">
<h3 class="component-title">Lists</h3>
<p class="component-description">Lists can be used to organize your data.</p>
<div class="component-example">
<div class="black-bg">
<ul class="list inset">
<li class="list-divider">Single Line List</li>
<li class="list-item-single-line">List item number one</li>
<li class="list-item-single-line">Second list item</li>
<li class="list-item-single-line">This is the third item and this is a very long line.</li>
</ul>
</div>
</div>
<pre class="prettyprint">
<ul class="list inset">
<li class="list-divider">Single Line List</li>
<li class="list-item-single-line">List item number one</li>
<li class="list-item-single-line">Second list item</li>
<li class="list-item-single-line">This is the third item and this is a very long line.</li>
</ul>
</pre>
</section>
<section id="two-line-lists" class="component">
<h3 class="component-title">2-Line Lists</h3>
<div class="component-example">
<div class="black-bg">
<ul class="list inset">
<li class="list-divider">2 Line List</li>
<li class="list-item-two-lines">
<h3>First Item</h3>
<p>Lorem ipsum dolor sit amet.</p>
</li>
<li class="list-item-two-lines">
<h3>Second Item</h3>
<p>Another list item's description.</p>
</li>
</ul>
</div>
</div>
<pre class="prettyprint">
<ul class="list inset">
<li class="list-divider">2 Line List</li>
<li class="list-item-two-lines">
<h3>First Item</h3>
<p>Lorem ipsum dolor sit amet.</p>
</li>
<li class="list-item-two-lines">
<h3>Second Item</h3>
<p>Another list item's description.</p>
</li>
</ul>
</pre>
</section>
<section id="multi-line-lists" class="component">
<h3 class="component-title">Multi Line Lists</h3>
<div class="component-example">
<div class="black-bg">
<ul class="list inset">
<li class="list-divider">Multi Line List</li>
<li class="list-item-multi-line">
<h3>Multi Line List Item</h3>
<p>Suspendisse potenti. Mauris accumsan consequat urna ut ornare. Nunc velit magna, vulputate ac faucibus eu, laoreet eget eros. Quisque tortor dui, gravida in condimentum non, tempus et nibh. Integer congue felis et diam hendrerit imperdiet. Sed pellentesque, ipsum nec vehicula molestie.</p>
</li>
<li class="list-item-multi-line">
<h3>Second Multi Line List Item</h3>
<p>Nunc velit magna, vulputate ac faucibus eu, laoreet eget eros. Quisque tortor dui, gravida in condimentum non, tempus et nibh.</p>
</li>
</ul>
</div>
</div>
<pre class="prettyprint">
<ul class="list inset">
<li class="list-divider">Multi Line List</li>
<li class="list-item-multi-line">
<h3>Multi Line List Item</h3>
<p>Suspendisse potenti. Mauris accumsan consequat urna ut ornare. Nunc velit magna, vulputate ac faucibus eu, laoreet eget eros. Quisque tortor dui, gravida in condimentum non, tempus et nibh. Integer congue felis et diam hendrerit imperdiet. Sed pellentesque, ipsum nec vehicula molestie.</p>
</li>
<li class="list-item-multi-line">
<h3>Second Multi Line List Item</h3>
<p>Nunc velit magna, vulputate ac faucibus eu, laoreet eget eros. Quisque tortor dui, gravida in condimentum non, tempus et nibh.</p>
</li>
</ul>
</pre>
</section>
<section id="forms" class="component">
<h3 class="component-title">Forms</h3>
<p class="component-description">The default style of the form component is at block level. All elements are sitting on its own line.</p>
<div class="component-example">
<div class="black-bg">
<form class="inset">
<label class="block-label">Email</label>
<input type="email" name="email" placeholder="Email" class="input-text">
<label class="block-label">Password</label>
<input type="password" name="password" placeholder="Password" class="input-text">
<div class="form-actions">
<input type="submit" class="btn btn-block" value="Submit"></input>
<button type="button" class="btn btn-block">Cancel</button>
</div>
</form>
</div>
</div>
<pre class="prettyprint">
<form class="inset">
<label class="block-label">Email</label>
<input type="email" name="email" placeholder="Email" class="input-text">
<label class="block-label">Password</label>
<input type="password" name="password" placeholder="Password" class="input-text">
<div class="form-actions">
<input type="submit" class="btn btn-block" value="Submit">
<button type="button" class="btn btn-block">Cancel</button>
</div>
</form>
</pre>
</section>
<section id="flexible-forms" class="component">
<h3 class="component-title">Flexible Forms</h3>
<p class="component-description">Flexible forms utilize the layout mode <a href="http://www.w3.org/TR/css3-flexbox/" target="_blank" class="open-link">flexbox</a> to fill out each elements parent container either growing to fill unused space or shrinking to avoid overflowing the parent. You can use this form layout by adding the <code>form-flex</code> class to the <code><form></code> tag.</p>
<p class="component-description">In a Fries prototype, elements inside a <code>flex-group</code> container are flexible by default.</p>
<div class="component-example">
<div class="black-bg">
<form class="form-flex inset">
<label class="block-label">Full Name</label>
<div class="flex-group">
<input type="text" placeholder="First Name" class="input-text flex1">
<input type="text" placeholder="Last Name" class="input-text flex1">
</div>
<label class="block-label">Address</label>
<div class="flex-group">
<input type="text" placeholder="Address" class="input-text flex2">
<div class="form-spinner">
<a href="javascript: void(0);" class="toggle-spinner">Home</a>
<ul class="spinner">
<li class="spinner-item"><a href="javascript: void(0);">Work</a></li>
<li class="spinner-item"><a href="javascript: void(0);">Secondary</a></li>
</ul>
</div>
</div>
</form>
</div>
</div>
<pre class="prettyprint">
<form class="form-flex inset">
<label class="block-label">Full Name</label>
<div class="flex-group">
<input type="text" placeholder="First Name" class="input-text flex1">
<input type="text" placeholder="Last Name" class="input-text flex1">
</div>
<label class="block-label">Address</label>
<div class="flex-group">
<input type="text" placeholder="Address" class="input-text flex2">
<div class="form-spinner">
<a href="javascript: void(0);" class="toggle-spinner">Home</a>
<ul class="spinner">
<li class="spinner-item"><a href="javascript: void(0);">Work</a></li>
<li class="spinner-item"><a href="javascript: void(0);">Secondary</a></li>
</ul>
</div>
</div>
</form>
</pre>
<p class="component-description">You can use the classes <code>flex1</code>, <code>flex2</code>, and <code>flex3</code> to tell how each form element <em>flexes</em> and just remove them if you want to fill the whole line.</p>
<pre class="prettyprint informational js">
<form class="form-flex">
<div class="flex-group">
<input type="text" placeholder="Full Name" class="input-text">
</div>
<div class="flex-group">
<input type="text" placeholder="Flex 1" class="input-text flex1">
<input type="text" placeholder="Flex 2" class="input-text flex2">
</div>
</form>
</pre>
</section>
<section id="dialogs" class="component">
<h3 class="component-title">Dialogs</h3>
<p class="component-description">A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.</p>
<div class="component-example">
<div class="black-bg inset">
<a href="javascript: void(0);" class="btn" id="show-dialog" data-ignore="true">Show Dialog</a>
</div>
</div>
<p class="component-description">The <code>.dialogs</code> container must be on the same level as <code>.action-bar</code> and <code>.tab-fixed</code>. This container holds all your dialogs.</p>
<pre class="prettyprint">
<!-- Button to show the dialog -->
<a href="javascript: void(0);" class="btn" id="show-dialog">Show Dialog</a>
<!-- Required container for dialogs -->
<div class="dialogs">
<div id="my-dialog" class="dialog">
<header class="dialog-title-region">
<h1 class="title">Hello Fries</h1>
</header>
<div class="dialog-content">
<p>Hi, I'm a dialog.</p>
</div>
<ul class="dialog-actions">
<li><a href="javascript: void(0);" class="dialog-cancel-button">Cancel</a></li>
<li><a href="javascript: void(0);" class="dialog-ok-button">OK</a></li>
</ul>
</div>
<!-- Other dialogs go here -->
</div>
</pre>
<p class="component-description">Then in your JavaScript code:</p>
<pre class="prettyprint">
var dialog = new fries.Dialog({
selector: '#my-dialog',
callbackOk: function () {
// Do something here
this.hide(); // hide the dialog
},
callbackCancel: function () {
// Do nothing, the user cancelled
this.hide(); // hide the dialog
}
});
</pre>
<p class="component-description">Then show the dialog with:</p>
<pre class="prettyprint">
dialog.show();
</pre>
</section>
<section id="toasts" class="component">
<h3 class="component-title">Toast Notifications</h3>
<p class="component-description">A Toast notification provides a subtle feedback to the users that something happened.</p>
<div class="component-example">
<div class="black-bg inset">
<a href="javascript: void(0);" class="btn" id="show-toast" data-ignore="true">Show Toast</a>
</div>
</div>
<p class="component-description">The good thing about Toast notifications in Fries is that no markup is needed, just JavaScript. Check out the following code to see how to create Toast notifications:</p>
<pre class="prettyprint">
// Add this to a 'click' or 'touchend' event of a button
var toast = new fries.Toast({ content: "Message saved as draft." });
</pre>
<p class="component-description">Pretty cool right? The code above creates a Toast notification with the message "Message saved as draft" and shows it to the user.</p>
<p class="component-description">You can also change the duration which the Toast is show by passing the length (in milliseconds) or by using either <code>fries.Toast.duration.SHORT</code> or <code>fries.Toast.duration.LONG</code> as a parameter when creating your Toast notifications.</p>
<pre class="prettyprint">
// A short Toast lasts 3 seconds
var shortToast = new fries.Toast({
content: "I'm a short Toast.",
duration: fries.Toast.duraton.SHORT
});
// A long one lasts 5 seconds
var longToast = new fries.Toast({
content: "I'm a long Toast.",
duration: fries.Toast.duration.LONG
});
// Or custom timing
var custom = new fries.Toast({
content: "Custom Toast",
duration: 7500 // in milliseconds
});
</pre>
</section>
<section id="helpers" class="component">
<h3 class="component-title">Helpers</h3>
<p class="component-description">There are a few helpers that you might want to take note of when you're creating Fries prototypes.</p>
<h4>Inset</h4>
<p>The <code>.inset</code> class adds a 15px padding to all sides of a container.</p>
<h4>Selectable</h4>
<p>The <code>.selectable</code> class adds a highlight to an element when it's in its <code>active</code> state. This is usually added to list items so they get highlighted when clicked or touched.</p>
<h4>Pretty Input</h4>
<p>By default, Fries styles text boxes such as <code><input type="text"></code> just as how they would normally look in a native Android app. This is done by wrapping these elements in <code><span class="input-pretty"></span></code>. This span adds those small lines on the edges of the element. However, you can turn this feature off by excluding <code>forms.js</code> in your build.</p>
</section>
<section id="stack-js" class="component">
<h3 class="component-title">Stack.js</h3>
<p class="component-description">Stack.js is an engine adapted from Ratchet's <a href="http://maker.github.io/ratchet/#push" target="_blank" class="open-link" data-ignore="true">push.js</a> to seamlessly piece together Fries pages. It dynamically loads HTML on the fly and inserts it to your app. This works by firing an AJAX request to get the target HTML and replacing the contents of <code>.page</code> div.</p>
<p class="component-description">Same as push.js, stack.js uses the HTML5 History API so the Android device's back button functionality doesn't break.</p>
<pre class="prettyprint informational js">
<!-- An action button that inserts map.html's .page into the current page's .page -->
<a href="map.html" class="action" title="Map"><i class="icon-location-marker"></i></a>
</pre>
<p class="component-description">You can also specify the transition by adding the <code>data-transition</code> attribute. You can choose from <code>push</code> and <code>pop</code> transitions when stacking pages.
<pre class="prettyprint informational js">
<!-- An action button that pushes map.html -->
<a href="map.html" class="action" title="Map" data-transition="push"><i class="icon-location-marker"></i></a>
</pre>
<p class="component-description">Since Stack.js listens for all touches, some of your links might not work. To solve this, you can add the data attribute <code>data-ignore="true"</code> so Stack.js ignores that link.</p>
<p class="component-description">You may, however, use your own paging engine for your prototypes. Just exclude Stack.js from your build and run your app normally. You'll lose the page animations this way though.</p>
</section>
</article>
<div class="dialogs">
<div id="my-dialog" class="dialog">
<header class="dialog-title-region">
<h1 class="title">Choose ringtone</h1>
</header>
<div class="dialog-content">
<ul class="list">
<li class="list-item-single-line">
<label>Default ringtone</label>
<label class="input-radio-wrapper pull-right">
<input type="radio" name="ringtone" class="input-radio" selected>
<div class="input-radio-inner">
<div class="input-radio-button"></div>
</div>
</label>
</li>
<li class="list-item-single-line">
<label>Silent</label>
<label class="input-radio-wrapper pull-right">
<input type="radio" name="ringtone" class="input-radio">
<div class="input-radio-inner">
<div class="input-radio-button"></div>
</div>
</label>
</li>
<li class="list-item-single-line">
<label>Aldebaran</label>
<label class="input-radio-wrapper pull-right">
<input type="radio" name="ringtone" class="input-radio">
<div class="input-radio-inner">
<div class="input-radio-button"></div>
</div>
</label>
</li>
</ul>
</div>
<ul class="dialog-actions">
<li><a href="javascript: void(0);" class="dialog-cancel-button">Cancel</a></li>
<li><a href="javascript: void(0);" class="dialog-ok-button">OK</a></li>
</ul>
</div>
</div>
</div>
<script src="examples/js/fingerblast.js"></script>
<script src="dist/fries.min.js"></script>