N°7243 - Add toast notifications to iTop (#614)

* N°7243 - Add toast notifications to iTop

* Apply suggestions from code review

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Apply suggestions from code review

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Apply suggestions from code review

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Apply suggestions from code review

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Apply suggestions from code review

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Apply suggestions from code review

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Update js/pages/backoffice/toolbox.js

* Update js/utils.js

* N°7243 - Move some rules to a dedicated partial and use spacing variables

---------

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
Stephen Abello
2024-02-16 10:59:05 +01:00
parent d775658980
commit 1dfb2e0a1a
26 changed files with 2151 additions and 7 deletions

View File

@@ -32,4 +32,5 @@
@import "search-form";
@import "field-badge";
@import "file-select";
@import "medallion-icon";
@import "medallion-icon";
@import "toast";

View File

@@ -0,0 +1,62 @@
/*
* @copyright Copyright (C) 2010-2024 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/* SCSS variables */
$ibo-toast--padding-y: $ibo-spacing-400 !default;
$ibo-toast--padding-right: $ibo-spacing-300 !default;
$ibo-toast--padding-left: $ibo-spacing-500 !default;
$ibo-toast--border-radius: $ibo-border-radius-300 !default;
$ibo-toast--box-shadow: $ibo-elevation-200 !default;
$ibo-toast--max-width: calc(50% - 20px) !default;
@keyframes decreaseHighlight {
0% {
height: 100%;
}
8%{
border-radius: 0 0 0 3px;
}
100% {
height: 0;
}
}
.ibo-toast {
display: inline-flex;
position: fixed;
align-items: center;
max-width: $ibo-toast--max-width ;
padding: $ibo-toast--padding-y $ibo-toast--padding-right $ibo-toast--padding-y $ibo-toast--padding-left;
border-radius: $ibo-toast--border-radius;
box-shadow: $ibo-toast--box-shadow;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
z-index: 2147483647;
&::before {
@include ibo-vertical-highlight;
top: initial;
bottom: 0;
border-radius: $ibo-toast--border-radius 0 0 $ibo-toast--border-radius;
}
&.ibo-is-auto-closeable::before{
animation: decreaseHighlight 5s linear forwards;
}
&:hover::before {
animation: none; /* Pause animation on hover */
}
&.ibo-is-error{
@extend .ibo-alert.ibo-is-danger;
}
&.ibo-is-warning{
@extend .ibo-alert.ibo-is-warning;
}
&.ibo-is-success{
@extend .ibo-alert.ibo-is-success;
}
&.ibo-is-information{
@extend .ibo-alert.ibo-is-information;
}
}

View File

@@ -17,4 +17,5 @@
@import "jquery-treeview";
@import "jquery-blockui";
@import "magnific-popup";
@import "selectize";
@import "selectize";
@import "toastify";

76
css/backoffice/vendors/_toastify.scss vendored Normal file
View File

@@ -0,0 +1,76 @@
/*
* @copyright Copyright (C) 2010-2024 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/* SCSS variables */
$ibo-vendors-toastify--right--right: $ibo-spacing-500 !default;
$ibo-vendors-toastify--left--left: $ibo-spacing-500 !default;
$ibo-vendors-toastify--top--top: -150px !default;
$ibo-vendors-toastify--bottom--bottom: -150px !default;
$ibo-vendors-toastify--close--background: transparent !default;
$ibo-vendors-toastify--close--padding: 0 !default;
$ibo-vendors-toastify--close--margin-left: $ibo-spacing-300 !default;
.toastify.on {
opacity: 1;
}
.toast-close {
background: $ibo-vendors-toastify--close--background;
border: 0;
color: inherit;
cursor: pointer;
font-family: inherit;
padding: $ibo-vendors-toastify--close--padding;
margin-left: $ibo-vendors-toastify--close--margin-left;
}
.toastify-right {
right: $ibo-vendors-toastify--right--right;
}
.toastify-left {
left: $ibo-vendors-toastify--left--left;
}
.toastify-top {
top: $ibo-vendors-toastify--top--top;
}
.toastify-bottom {
bottom: $ibo-vendors-toastify--bottom--bottom;
}
.toastify-rounded {
border-radius: 25px;
}
.toastify-avatar {
width: 1.5em;
height: 1.5em;
margin: -7px 5px;
border-radius: 2px;
}
.toastify-center {
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
max-width: fit-content;
max-width: -moz-fit-content;
}
@media only screen and (max-width: 360px) {
.toastify-right, .toastify-left {
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
max-width: fit-content;
}
}