|
5 | 5 | require 'init.php'; |
6 | 6 | use \atk4\ui\Button; |
7 | 7 | use \atk4\ui\Buttons; |
8 | | -use \atk4\ui\H2; |
| 8 | +use \atk4\ui\Header; |
9 | 9 | use \atk4\ui\Icon; |
10 | 10 | use \atk4\ui\Label; |
11 | 11 | use \atk4\ui\Template; |
12 | 12 | use \atk4\ui\View; |
13 | 13 |
|
14 | | -$layout->add(new H2('Basic Button')); |
| 14 | +$layout->add(new Header(['Basic Button', 'size'=>2])); |
15 | 15 | $layout->add(new Button())->set('Click me'); |
16 | 16 |
|
17 | | -$layout->add(new H2('Properties')); |
| 17 | +$layout->add(new Header(['Properties', 'size'=>2])); |
18 | 18 |
|
19 | 19 | $b1 = new Button(); |
20 | 20 | $b2 = new Button(); |
21 | 21 | $b3 = new Button(); |
| 22 | +$b4 = new Button(); |
22 | 23 |
|
23 | 24 | $b1->set(['Load', 'primary']); |
24 | 25 | $b2->set(['Load', 'labeled', 'icon'=>'pause']); |
25 | | -$b3->set(['Next', 'right labeled', 'icon'=>'right arrow']); |
| 26 | +$b3->set(['Next', 'iconRight'=>'right arrow']); |
| 27 | +$b4->set([false, 'circular', 'icon'=>'settings']); |
26 | 28 | $layout->add($b1); |
27 | 29 | $layout->add($b2); |
28 | 30 | $layout->add($b3); |
| 31 | +$layout->add($b4); |
29 | 32 |
|
30 | 33 | $button = new Button(); |
31 | 34 | $button->set('Click me'); |
32 | 35 | $button->set(['primary' => true]); |
33 | 36 | $button->set(['icon'=>'check']); |
34 | 37 | $button->set(['size big'=>true]); |
35 | 38 |
|
36 | | -$layout->add(new H2('Big Button')); |
| 39 | +$layout->add(new Header(['Big Button', 'size'=>2])); |
37 | 40 |
|
38 | 41 | $layout->add($button); |
39 | 42 |
|
40 | | -$layout->add(new H2('Button Intent')); |
| 43 | +$layout->add(new Header(['Button Intent', 'size'=>2])); |
41 | 44 |
|
42 | 45 | $b_yes = new Button(['Yes', 'positive basic']); |
43 | 46 | $b_no = new Button(['No', 'negative basic']); |
44 | 47 | $layout->add($b_yes); |
45 | 48 | $layout->add($b_no); |
46 | 49 |
|
47 | | -$layout->add(new H2('Combining Buttons')); |
| 50 | +$layout->add(new Header(['Combining Buttons', 'size'=>2])); |
48 | 51 | $bar = new Buttons('vertical'); // NOTE: class called Buttons, not Button |
49 | 52 | $bar->add(new Button(['Play', 'icon'=>'play'])); |
50 | 53 | $bar->add(new Button(['Pause', 'icon'=>'pause'])); |
51 | 54 | $bar->add(new Button(['Shuffle', 'icon'=>'shuffle'])); |
52 | 55 |
|
53 | 56 | $layout->add($bar); |
54 | 57 |
|
55 | | -$layout->add(new H2('Icon Bar')); |
| 58 | +$layout->add(new Header(['Icon Bar', 'size'=>2])); |
56 | 59 | $bar = new Buttons('blue big'); |
57 | 60 | $bar->add(new Button(['icon'=>'file'])); |
58 | 61 | $bar->add(new Button(['icon'=>['save', 'yellow']])); |
59 | 62 | $bar->add(new Button(['icon'=>'upload', 'disabled'=>true])); |
60 | 63 | $layout->add($bar); |
61 | 64 |
|
62 | | -$layout->add(new H2('Forks')); |
| 65 | +$layout->add(new Header(['Forks', 'size'=>2])); |
63 | 66 | $forks = new Button(['labeled'=> true]); // Button, not Buttons! |
64 | 67 | $forks->add(new Button(['Forks', 'blue']))->add(new Icon('fork')); |
65 | 68 | $forks->add(new Label(['1,048', 'basic blue left pointing'])); |
66 | 69 | $layout->add($forks); |
67 | 70 |
|
68 | | -$layout->add(new H2('Custom Template')); |
| 71 | +$layout->add(new Header(['Custom Template', 'size'=>2])); |
69 | 72 | $view = new View(['template'=>new Template('Hello, {$tag1}, my name is {$tag2}')]); |
70 | 73 |
|
71 | 74 | $view->add(new Button('World'), 'tag1'); |
72 | 75 | $view->add(new Button(['Agile UI', 'blue']), 'tag2'); |
73 | 76 |
|
74 | 77 | $layout->add($view); |
| 78 | + |
| 79 | +$layout->add(new Header(['Attaching', 'size'=>2])); |
| 80 | + |
| 81 | +$layout->add(['Button', 'Scroll Up', 'top attached']); |
| 82 | +$layout->add(['Grid', 'attached', 'header'=>false])->setSource(['One', 'Two', 'Three', 'Four']); |
| 83 | +$layout->add(['Button', 'Scroll Up', 'bottom attached']); |
0 commit comments