Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
15 / 15 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UIUtils | |
100.00% |
15 / 15 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| createCodexProgressIndicator | |
100.00% |
15 / 15 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * WikiLambda UI rendering utilities |
| 4 | * |
| 5 | * @file |
| 6 | * @ingroup Extensions |
| 7 | * @copyright 2020– Abstract Wikipedia team; see AUTHORS.txt |
| 8 | * @license MIT |
| 9 | */ |
| 10 | |
| 11 | namespace MediaWiki\Extension\WikiLambda; |
| 12 | |
| 13 | use MediaWiki\Html\Html; |
| 14 | |
| 15 | class UIUtils { |
| 16 | /** |
| 17 | * Generate a Codex progress indicator HTML element. |
| 18 | * |
| 19 | * @param string $ariaLabel The ARIA label for the progress indicator |
| 20 | * @return string The HTML of the progress indicator element |
| 21 | */ |
| 22 | public static function createCodexProgressIndicator( string $ariaLabel ): string { |
| 23 | return Html::rawElement( |
| 24 | 'div', |
| 25 | [ 'class' => 'cdx-progress-indicator' ], |
| 26 | Html::rawElement( |
| 27 | 'div', |
| 28 | [ 'class' => 'cdx-progress-indicator__indicator' ], |
| 29 | Html::element( |
| 30 | 'progress', |
| 31 | [ |
| 32 | 'class' => 'cdx-progress-indicator__indicator__progress', |
| 33 | 'aria-label' => $ariaLabel |
| 34 | ] |
| 35 | ) |
| 36 | ) |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | } |