]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - vendor/oojs/oojs-ui/demos/classes/ButtonStyleShowcaseWidget.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / oojs / oojs-ui / demos / classes / ButtonStyleShowcaseWidget.php
1 <?php
2
3 namespace Demo;
4
5 use OOUI;
6
7 class ButtonStyleShowcaseWidget extends OOUI\Widget {
8
9         protected static $styles = [
10                 [],
11                 [
12                         'flags' => [ 'progressive' ],
13                 ],
14                 [
15                         'flags' => [ 'constructive' ],
16                 ],
17                 [
18                         'flags' => [ 'destructive' ],
19                 ],
20                 [
21                         'flags' => [ 'primary', 'progressive' ],
22                 ],
23                 [
24                         'flags' => [ 'primary', 'constructive' ],
25                 ],
26                 [
27                         'flags' => [ 'primary', 'destructive' ],
28                 ],
29         ];
30         protected static $states = [
31                 [
32                         'label' => 'Button',
33                 ],
34                 [
35                         'label' => 'Button',
36                         'icon' => 'tag',
37                 ],
38                 [
39                         'label' => 'Button',
40                         'icon' => 'tag',
41                         'indicator' => 'down',
42                 ],
43                 [
44                         'icon' => 'tag',
45                         'title' => "Title text",
46                 ],
47                 [
48                         'indicator' => 'down',
49                 ],
50                 [
51                         'icon' => 'tag',
52                         'indicator' => 'down',
53                 ],
54                 [
55                         'label' => 'Button',
56                         'disabled' => true,
57                 ],
58                 [
59                         'icon' => 'tag',
60                         'title' => "Title text",
61                         'disabled' => true,
62                 ],
63                 [
64                         'indicator' => 'down',
65                         'disabled' => true,
66                 ],
67         ];
68
69         public function __construct( array $config = [] ) {
70                 parent::__construct( $config );
71
72                 $this->addClasses( [ 'demo-buttonStyleShowcaseWidget' ] );
73
74                 foreach ( self::$styles as $style ) {
75                         $buttonRow = new OOUI\Tag( 'div' );
76                         foreach ( self::$states as $state ) {
77                                 $buttonRow->appendContent(
78                                         new OOUI\ButtonWidget( array_merge( $style, $state ) )
79                                 );
80                         }
81                         $this->appendContent( $buttonRow );
82                 }
83         }
84
85         protected function getJavaScriptClassName() {
86                 return 'Demo.ButtonStyleShowcaseWidget';
87         }
88 }