Add a Factory for 'Cancel' buttons, make 'Cancel' buttons alternative, make buttons uppercase

This commit is contained in:
Stephen Abello
2021-02-02 16:17:03 +01:00
parent 50af5d9af1
commit f1d047becf
3 changed files with 26 additions and 2 deletions

View File

@@ -2589,7 +2589,7 @@ CSS
$oToolbarTop = new Toolbar();
$oToolbarTop->SetCSSClasses(['ibo-toolbar', 'ibo-toolbar-top']);
$oCancelButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Cancel'));
$oCancelButton = ButtonUIBlockFactory::MakeForCancel();
$oCancelButton->AddCSSClasses(['action', 'cancel']);
$oToolbarTop->AddSubBlock($oCancelButton);
$oApplyButton = ButtonUIBlockFactory::MakeForPrimaryAction($sApplyButton, null, null, true);

View File

@@ -389,7 +389,8 @@ $ibo-button-colors: (
.ibo-button {
cursor: pointer;
@extend %ibo-font-ral-med-150;
@extend %ibo-font-ral-sembol-100;
text-transform: uppercase;
padding: $ibo-button--padding-y $ibo-button--padding-x;
border: $ibo-button--border;
border-radius: $ibo-button--border-radius;

View File

@@ -20,6 +20,7 @@
namespace Combodo\iTop\Application\UI\Base\Component\Button;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Dict;
/**
* Class ButtonUIBlockFactory
@@ -259,6 +260,28 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
$bIsSubmit, $sId);
}
/**
* Make a Button component for a cancel, should be used only for UI navigation, not destructive action
*
* @param string|null $sLabel
* @param string|null $sName See Button::$sName
* @param string|null $sValue See Button::$sValue
* @param bool $bIsSubmit See Button::$sType
* @param string|null $sId
*
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
*/
public static function MakeForCancel(
string $sLabel = null,
string $sName = null,
string $sValue = null,
bool $bIsSubmit = false,
?string $sId = null
): Button {
$sLabel = $sLabel ?? Dict::S('UI:Button:Cancel');
return static::MakeForAction($sLabel, Button::ENUM_COLOR_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
}
//----------------------------------------------------------------------------------------------
// Link buttons, mostly used outside forms, to redirect somewhere whilst keeping a button aspect
//----------------------------------------------------------------------------------------------