toastr-bs4-alert.scss 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. // Position
  2. .toast-center-center {
  3. top: 50%;
  4. left: 50%;
  5. transform: translate(-50%, -50%);
  6. }
  7. .toast-top-center {
  8. top: 0;
  9. right: 0;
  10. width: 100%;
  11. }
  12. .toast-bottom-center {
  13. bottom: 0;
  14. right: 0;
  15. width: 100%;
  16. }
  17. .toast-top-full-width {
  18. top: 0;
  19. right: 0;
  20. width: 100%;
  21. }
  22. .toast-bottom-full-width {
  23. bottom: 0;
  24. right: 0;
  25. width: 100%;
  26. }
  27. .toast-top-left {
  28. top: 12px;
  29. left: 12px;
  30. }
  31. .toast-top-right {
  32. top: 12px;
  33. right: 12px;
  34. }
  35. .toast-bottom-right {
  36. right: 12px;
  37. bottom: 12px;
  38. }
  39. .toast-bottom-left {
  40. bottom: 12px;
  41. left: 12px;
  42. }
  43. .toast-container.toast-top-center .ngx-toastr,
  44. .toast-container.toast-bottom-center .ngx-toastr {
  45. width: 300px;
  46. margin-left: auto;
  47. margin-right: auto;
  48. }
  49. .toast-container.toast-top-full-width .ngx-toastr,
  50. .toast-container.toast-bottom-full-width .ngx-toastr {
  51. width: 96%;
  52. margin-left: auto;
  53. margin-right: auto;
  54. }
  55. // Toast
  56. .toast-container {
  57. pointer-events: none;
  58. position: fixed;
  59. z-index: 999999;
  60. .ngx-toastr {
  61. @include border-radius($alert-border-radius);
  62. position: relative;
  63. overflow: hidden;
  64. margin: 0 0 6px;
  65. padding: 0.75rem 1.25rem 0.75rem 50px;
  66. width: 300px;
  67. background-position: 15px center;
  68. background-repeat: no-repeat;
  69. background-size: 24px;
  70. box-shadow: 0 0 10px rgba(0, 0, 0, 0.03);
  71. pointer-events: auto;
  72. .toast-title {
  73. font-weight: bold;
  74. }
  75. .toast-message {
  76. word-wrap: break-word;
  77. }
  78. .toast-message a:hover {
  79. text-decoration: underline;
  80. }
  81. .toast-close-button {
  82. position: relative;
  83. right: -0.3em;
  84. top: -0.3em;
  85. float: right;
  86. font-size: 20px;
  87. font-weight: bold;
  88. color: inherit;
  89. text-shadow: 0 1px 0 #fff;
  90. opacity: 0.5;
  91. background: transparent;
  92. border: 0;
  93. padding: 0;
  94. }
  95. .toast-progress {
  96. position: absolute;
  97. left: 0;
  98. bottom: 0;
  99. height: 4px;
  100. background-color: #000000;
  101. opacity: 0.3;
  102. }
  103. .toast-close-button:hover,
  104. .toast-close-button:focus {
  105. color: #000000;
  106. text-decoration: none;
  107. cursor: pointer;
  108. opacity: 0.75;
  109. }
  110. }
  111. .ngx-toastr:hover {
  112. box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  113. opacity: 1;
  114. cursor: pointer;
  115. }
  116. }
  117. @function str-split($string, $separator) {
  118. $split-arr: ();
  119. // first index of separator in string
  120. $index: str-index($string, $separator);
  121. // loop through string
  122. @while $index != null {
  123. // get the substring from the first character to the separator
  124. $item: str-slice($string, 1, $index - 1);
  125. // push item to array
  126. $split-arr: append($split-arr, $item);
  127. // remove item and separator from string
  128. $string: str-slice($string, $index + 1);
  129. // find new index of separator
  130. $index: str-index($string, $separator);
  131. }
  132. // add the remaining string to list (the last item)
  133. $split-arr: append($split-arr, $string);
  134. @return $split-arr;
  135. }
  136. @function svg-factory($fill-color, $viewbox, $path) {
  137. $split: str-split($viewbox, ' ');
  138. $width: nth($split, 3);
  139. $height: nth($split, 4);
  140. // opacity is 0.9999 otherwise it uses a hex equivelent
  141. // firefox requires fill rgb
  142. @return "%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='" + $viewbox +
  143. "' width='" + $width + "' height='" + $height + "'%3E%3Cpath fill='" +
  144. rgba($fill-color, 0.999999) + "' d='" + $path + "'/%3E%3C/svg%3E";
  145. }
  146. @function svg-encode($svg) {
  147. @return 'data:image/svg+xml;charset=utf8,' + $svg;
  148. }
  149. .toast-success {
  150. /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/solid/check.svg */
  151. background-image: url(svg-encode(
  152. svg-factory(
  153. theme-color-level('success', 6),
  154. '0 0 512 512',
  155. 'M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z'
  156. )
  157. ));
  158. color: theme-color-level('success', 6);
  159. background-color: theme-color-level('success', -10);
  160. border: 1px solid theme-color-level('success', -9);
  161. }
  162. .toast-error {
  163. /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/solid/times-circle.svg */
  164. background-image: url(svg-encode(
  165. svg-factory(
  166. theme-color-level('danger', 6),
  167. '0 0 512 512',
  168. 'M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z'
  169. )
  170. ));
  171. color: theme-color-level('danger', 6);
  172. background-color: theme-color-level('danger', -10);
  173. border: 1px solid theme-color-level('danger', -9);
  174. }
  175. .toast-info {
  176. /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/solid/info-circle.svg */
  177. background-image: url(svg-encode(
  178. svg-factory(
  179. theme-color-level('info', 6),
  180. '0 0 512 512',
  181. 'M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z'
  182. )
  183. ));
  184. color: theme-color-level('info', 6);
  185. background-color: theme-color-level('info', -10);
  186. border: 1px solid theme-color-level('info', -9);
  187. }
  188. .toast-warning {
  189. /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/solid/exclamation-triangle.svg */
  190. background-image: url(svg-encode(
  191. svg-factory(
  192. theme-color-level('warning', 6),
  193. '0 0 576 512',
  194. 'M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z'
  195. )
  196. ));
  197. color: theme-color-level('warning', 6);
  198. background-color: theme-color-level('warning', -10);
  199. border: 1px solid theme-color-level('warning', -9);
  200. }
  201. // Responsive Design
  202. @media all and (max-width: 240px) {
  203. .toast-container .ngx-toastr.div {
  204. padding: 8px 8px 8px 50px;
  205. width: 11em;
  206. }
  207. .toast-container .toast-close-button {
  208. right: -0.2em;
  209. top: -0.2em;
  210. }
  211. }
  212. @media all and (min-width: 241px) and (max-width: 480px) {
  213. .toast-container .ngx-toastr.div {
  214. padding: 8px 8px 8px 50px;
  215. width: 18em;
  216. }
  217. .toast-container .toast-close-button {
  218. right: -0.2em;
  219. top: -0.2em;
  220. }
  221. }
  222. @media all and (min-width: 481px) and (max-width: 768px) {
  223. .toast-container .ngx-toastr.div {
  224. padding: 15px 15px 15px 50px;
  225. width: 25em;
  226. }
  227. }