Skip to content

Commit

Permalink
extend the toast container interface about timings
Browse files Browse the repository at this point in the history
  • Loading branch information
iszmais committed Jun 13, 2024
1 parent 0053a12 commit f65c1bc
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 19 deletions.
24 changes: 18 additions & 6 deletions src/UI/Component/Toast/Container.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,14 +16,12 @@
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\Component\Toast;

use ILIAS\UI\Component\Component;

/**
* Interface Container
* @package ILIAS\UI\Component\Toast
*/
interface Container extends Component
{
/**
Expand All @@ -36,4 +32,20 @@ public function getToasts(): array;
public function withAdditionalToast(Toast $toast): Container;

public function withoutToasts(): Container;

/**
* Create a copy of this toast with a vanish time in seconds.
* The vanish time defines the time after which the toast vanishes.
*/
public function withVanishTime(int $vanishTime): Container;

public function getVanishTime(): int;

/**
* Create a copy of this toast with a delay time in miliseconds.
* The delay time defines the time when the toast is shown after a page refresh or an asyncronous update.
*/
public function withDelayTime(int $delayTime): Container;

public function getDelayTime(): int;
}
7 changes: 2 additions & 5 deletions src/UI/Component/Toast/Factory.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,13 +16,12 @@
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\Component\Toast;

use ILIAS\UI\Component\Symbol\Icon\Icon;

/**
* This is how a factory for Toast looks like.
*/
interface Factory
{
/**
Expand Down
12 changes: 6 additions & 6 deletions src/UI/Component/Toast/Toast.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\Component\Toast;

use ILIAS\UI\Component\Button\Shy;
Expand All @@ -28,10 +28,6 @@
use ILIAS\UI\Component\Symbol\Icon\Icon;
use ILIAS\UI\Implementation\Component\SignalGeneratorInterface;

/**
* Interface Toast
* @package ILIAS\UI\Component\Toast
*/
interface Toast extends Component, JavaScriptBindable
{
/**
Expand All @@ -43,6 +39,10 @@ public function withDescription(string $description): Toast;

public function getDescription(): string;

/**
* Create a copy of this toast with a link, which is shown in the toasts content.
* A toast can have multiple links.
*/
public function withAdditionalLink(Link $link): Toast;

public function withoutLinks(): Toast;
Expand Down
33 changes: 31 additions & 2 deletions src/UI/Implementation/Component/Toast/Container.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,10 +16,13 @@
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\Implementation\Component\Toast;

use ILIAS\UI\Implementation\Component\ComponentHelper;
use ILIAS\UI\Component\Toast as ComponentInterface;
use ILIAS\UI\NotImplementedException;

class Container implements ComponentInterface\Container
{
Expand Down Expand Up @@ -50,4 +51,32 @@ public function withoutToasts(): Container
$clone->toasts = [];
return $clone;
}

/**
* Create a copy of this container with a vanish time in miliseconds.
* The vanish time defines the time after which the toasts vanish.
*/
public function withVanishTime(int $vanishTime): Container
{
throw new NotImplementedException();
}

public function getVanishTime(): int
{
throw new NotImplementedException();
}

/**
* Create a copy of this container with a delay time in miliseconds.
* The delay time defines the time when the toasts are shown after a page refresh or an asyncronous update.
*/
public function withDelayTime(int $delayTime): Container
{
throw new NotImplementedException();
}

public function getDelayTime(): int
{
throw new NotImplementedException();
}
}

0 comments on commit f65c1bc

Please sign in to comment.