scss: add option to display icons in forms buttons (#74954) #205

Merged
smihai merged 2 commits from wip/74954-option-for-buttons-with-icons into main 2023-04-06 10:18:38 +02:00
2 changed files with 53 additions and 0 deletions

View File

@ -665,6 +665,12 @@ paramètre, la deuxième sa description et la troisième la valeur par défaut.
</td>
<td><p><var>null</var></p></td>
</tr>
<tr>
<td><p><code>$buttons-with-icons</code></p></td>
<td><p>Ajoute des icônes aux boutons des formulaires des demandes.</p>
</td>
<td><p><var>false</var></p></td>
</tr>
<tr>
<td><p><code>$timetable-cell-background</code></p></td>
<td><p>Couleur de fond des créneaux horaires.</p>

View File

@ -45,7 +45,11 @@ $form-style: classic !default;
// optionnal (grow) option to move next button to right (ex: cancel (grow), previous, submit);
$buttons-order: null !default;
$buttons-alignment: null !default; // any flexbox justify-content value;
$buttons-with-icons: false !default;
$submit-button-icon: '\f105' !default; /* angle right */
$previous-button-icon: '\f104' !default; /* angle left */
$cancel-button-icon: '\f00d' !default; /* remove icon */
%custom-radio-checkbox-widget {
label {
@ -652,6 +656,49 @@ div.select2-search {
}
}
// Button with FontAwesome icon
// $position: left || right
// $character : UTF value
@mixin button-with-icon($position: right, $character: '\f105') {
&::before, &::after {
font-family: FontAwesome;
}
@if ($position == left) {
&::before {
content: $character;
margin-right: 0.5em;
}
}
@if ($position == right) {
&::after {
content: $character;
margin-left: 0.5em;
}
}
}
@if $buttons-with-icons {
.submit-button-with-icon {
@include button-with-icon(right, $submit-button-icon);
}
.previous-button-with-icon {
@include button-with-icon(left, $previous-button-icon);
}
.cancel-button-with-icon {
@include button-with-icon(left, $cancel-button-icon);
}
.quixote:not(#wf-actions) div.buttons {
@each $btn in (submit, previous, cancel) {
.#{$btn}-button button {
@extend .#{$btn}-button-with-icon;
}
}
}
}
// Buttons order & alignment configuration
@if $buttons-order or $buttons-alignment {
.quixote:not(#wf-actions) div.buttons {