Skip to content

Commit

Permalink
Add check and uncheck glyph
Browse files Browse the repository at this point in the history
  • Loading branch information
iszmais committed Jul 3, 2024
1 parent d63a010 commit 77ec970
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 0 deletions.
48 changes: 48 additions & 0 deletions components/ILIAS/UI/src/Component/Symbol/Glyph/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -1460,4 +1460,52 @@ public function link(string $action = null): Glyph;
* @return \ILIAS\UI\Component\Symbol\Glyph\Glyph
*/
public function launch(string $action = null): Glyph;

/**
* ---
* description:
* purpose: >
* The Check Glyph indicates a positive status (e.g. approved/complete/ok/yes/finished/passed)
* composition: >
* The Check Glyph uses a checkmark.
* context:
* - The Check Glyph can be used in combination with the Uncheck Glyph to display binary states.
* rules:
* accessibility:
* 1: >
* The aria-label MUST be 'check'.
* style:
* 1: >
* The Check Glyph SHOULD display a checkmark in the geometric focus of a mono-colored symmetric shape
* usage:
* 1: >
* The Check Glyph SHOULD be used to display a unary state or one option of a binary state.
* ---
* @return \ILIAS\UI\Component\Symbol\Glyph\Glyph
*/
public function check(): Glyph;

/**
* ---
* description:
* purpose: >
* The Uncheck Glyph indicates a negative status (e.g. disapproved/blocked/no/failed/rejected)
* composition: >
* The Check Glyph uses a diagonal cross.
* context:
* - The Uncheck Glyph can be used in combination with the Check Glyph to display binary states.
* rules:
* accessibility:
* 1: >
* The aria-label MUST be 'uncheck'.
* style:
* 1: >
* The uncheck Glyph SHOULD display a symmetric diagonal cross in the geometric focus of a mono-colored symmetric shape
* usage:
* 1: >
* The Uncheck Glyph SHOULD be used to display a unary state or one option of a binary state.
* ---
* @return \ILIAS\UI\Component\Symbol\Glyph\Glyph
*/
public function uncheck(): Glyph;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace ILIAS\UI\Implementation\Component\Symbol\Glyph;

use ILIAS\UI\Component\Symbol\Glyph as G;
use ILIAS\UI\NotImplementedException;

class Factory implements G\Factory
{
Expand Down Expand Up @@ -432,4 +433,20 @@ public function launch(string $action = null): G\Glyph
{
return new Glyph(G\Glyph::LAUNCH, "launch", $action);
}

/**
* @inheritdoc
*/
public function check(): G\Glyph
{
throw new NotImplementedException();
}

/**
* @inheritdoc
*/
public function uncheck(): G\Glyph
{
throw new NotImplementedException();
}
}
38 changes: 38 additions & 0 deletions components/ILIAS/UI/src/examples/Symbol/Glyph/Check/check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\examples\Symbol\Glyph\Check;

function check()
{
global $DIC;
$f = $DIC->ui()->factory();
$renderer = $DIC->ui()->renderer();

$glyph = $f->symbol()->glyph()->check();

//Showcase the various states of this Glyph
$list = $f->listing()->descriptive([
"Active" => $glyph,
"Inactive" => $glyph->withUnavailableAction(),
"Highlighted" => $glyph->withHighlight()
]);

return $renderer->render($list);
}
38 changes: 38 additions & 0 deletions components/ILIAS/UI/src/examples/Symbol/Glyph/Uncheck/uncheck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\examples\Symbol\Glyph\Uncheck;

function uncheck()
{
global $DIC;
$f = $DIC->ui()->factory();
$renderer = $DIC->ui()->renderer();

$glyph = $f->symbol()->glyph()->uncheck();

//Showcase the various states of this Glyph
$list = $f->listing()->descriptive([
"Active" => $glyph,
"Inactive" => $glyph->withUnavailableAction(),
"Highlighted" => $glyph->withHighlight()
]);

return $renderer->render($list);
}

0 comments on commit 77ec970

Please sign in to comment.