sweet-alert.scss 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. // SweetAlert
  2. // 2014 (c) - Tristan Edwards
  3. // github.com/t4t5/sweetalert
  4. .sweet-overlay {
  5. background-color: rgb(0, 0, 0); /* IE8 */
  6. -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"; /* IE8 */
  7. background-color: rgba(black, 0.4);
  8. position: fixed;
  9. left: 0;
  10. right: 0;
  11. top: 0;
  12. bottom: 0;
  13. display: none;
  14. z-index: 10000;
  15. }
  16. .sweet-alert {
  17. $width: 478px;
  18. $padding: 17px;
  19. background-color: white;
  20. font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  21. width: $width;
  22. padding: $padding;
  23. border-radius: 5px;
  24. text-align: center;
  25. position: fixed;
  26. left: 50%;
  27. top: 50%;
  28. margin-left: -($width/2 + $padding);
  29. margin-top: -200px;
  30. overflow: hidden;
  31. display: none;
  32. z-index: 99999;
  33. @media all and (max-width: 540px) {
  34. width: auto;
  35. margin-left: 0;
  36. margin-right: 0;
  37. left: 15px;
  38. right: 15px;
  39. }
  40. h2 {
  41. color: #575757;
  42. font-size: 30px;
  43. text-align: center;
  44. font-weight: 600;
  45. text-transform: none;
  46. position: relative;
  47. margin: 25px 0;
  48. padding: 0;
  49. line-height: 40px;
  50. display: block;
  51. }
  52. p {
  53. color: #797979;
  54. font-size: 16px;
  55. text-align: center;
  56. font-weight: 300;
  57. position: relative;
  58. text-align: inherit;
  59. float: none;
  60. margin: 0;
  61. padding: 0;
  62. line-height: normal;
  63. }
  64. button {
  65. $btnBlue: #AEDEF4;
  66. $btnGray: #D0D0D0;
  67. background-color: $btnBlue;
  68. color: white;
  69. border: none;
  70. box-shadow: none;
  71. font-size: 17px;
  72. font-weight: 500;
  73. -webkit-border-radius: 4px;
  74. border-radius: 5px;
  75. padding: 10px 32px;
  76. margin: 26px 5px 0 5px;
  77. cursor: pointer;
  78. &:focus {
  79. outline: none;
  80. box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  81. }
  82. &:hover {
  83. background-color: darken($btnBlue, 3%);
  84. }
  85. &:active {
  86. background-color: darken($btnBlue, 10%);
  87. }
  88. &.cancel {
  89. background-color: $btnGray;
  90. &:hover {
  91. background-color: darken($btnGray, 3%);
  92. }
  93. &:active {
  94. background-color: darken($btnGray, 10%);
  95. }
  96. // Cancel button should keep the same style
  97. &:focus {
  98. box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important;
  99. }
  100. }
  101. // Removes selection outline in Firefox
  102. &::-moz-focus-inner {
  103. border: 0;
  104. }
  105. }
  106. // Only show focus-style when there is multiple choice of actions
  107. &[data-has-cancel-button=false] button {
  108. box-shadow: none !important;
  109. }
  110. &[data-has-confirm-button=false][data-has-cancel-button=false] {
  111. padding-bottom: 40px;
  112. }
  113. .sa-icon {
  114. $red: #F27474;
  115. $orange: #F8BB86;
  116. $blue: #C9DAE1;
  117. $green: #A5DC86;
  118. width: 80px;
  119. height: 80px;
  120. border: 4px solid gray;
  121. -webkit-border-radius: 40px;
  122. border-radius: 40px;
  123. border-radius: 50%;
  124. margin: 20px auto;
  125. padding: 0;
  126. position: relative;
  127. box-sizing: content-box;
  128. &.sa-error {
  129. border-color: $red;
  130. .sa-x-mark {
  131. position: relative;
  132. display: block;
  133. }
  134. .sa-line {
  135. position: absolute;
  136. height: 5px;
  137. width: 47px;
  138. background-color: $red;
  139. display: block;
  140. top: 37px;
  141. border-radius: 2px;
  142. &.sa-left {
  143. -webkit-transform: rotate(45deg);
  144. transform: rotate(45deg);
  145. left: 17px;
  146. }
  147. &.sa-right {
  148. -webkit-transform: rotate(-45deg);
  149. transform: rotate(-45deg);
  150. right: 16px;
  151. }
  152. }
  153. }
  154. &.sa-warning {
  155. border-color: $orange;
  156. .sa-body { // Exclamation mark body
  157. position: absolute;
  158. width: 5px;
  159. height: 47px;
  160. left: 50%;
  161. top: 10px;
  162. -webkit-border-radius: 2px;
  163. border-radius: 2px;
  164. margin-left: -2px;
  165. background-color: $orange;
  166. }
  167. .sa-dot { // Exclamation mark dot
  168. position: absolute;
  169. width: 7px;
  170. height: 7px;
  171. -webkit-border-radius: 50%;
  172. border-radius: 50%;
  173. margin-left: -3px;
  174. left: 50%;
  175. bottom: 10px;
  176. background-color: $orange;
  177. }
  178. }
  179. &.sa-info {
  180. border-color: $blue;
  181. &::before { // i-letter body
  182. content: "";
  183. position: absolute;
  184. width: 5px;
  185. height: 29px;
  186. left: 50%;
  187. bottom: 17px;
  188. border-radius: 2px;
  189. margin-left: -2px;
  190. background-color: $blue;
  191. }
  192. &::after { // i-letter dot
  193. content: "";
  194. position: absolute;
  195. width: 7px;
  196. height: 7px;
  197. border-radius: 50%;
  198. margin-left: -3px;
  199. top: 19px;
  200. background-color: $blue;
  201. }
  202. }
  203. &.sa-success {
  204. border-color: $green;
  205. &::before, &::after { // Emulate moving circular line
  206. content: '';
  207. -webkit-border-radius: 40px;
  208. border-radius: 40px;
  209. border-radius: 50%;
  210. position: absolute;
  211. width: 60px;
  212. height: 120px;
  213. background: white;
  214. -webkit-transform: rotate(45deg);
  215. transform: rotate(45deg);
  216. }
  217. &::before {
  218. -webkit-border-radius: 120px 0 0 120px;
  219. border-radius: 120px 0 0 120px;
  220. top: -7px;
  221. left: -33px;
  222. -webkit-transform: rotate(-45deg);
  223. transform: rotate(-45deg);
  224. -webkit-transform-origin: 60px 60px;
  225. transform-origin: 60px 60px;
  226. }
  227. &::after {
  228. -webkit-border-radius: 0 120px 120px 0;
  229. border-radius: 0 120px 120px 0;
  230. top: -11px;
  231. left: 30px;
  232. -webkit-transform: rotate(-45deg);
  233. transform: rotate(-45deg);
  234. -webkit-transform-origin: 0px 60px;
  235. transform-origin: 0px 60px;
  236. }
  237. .sa-placeholder { // Ring
  238. width: 80px;
  239. height: 80px;
  240. border: 4px solid rgba($green, 0.2);
  241. -webkit-border-radius: 40px;
  242. border-radius: 40px;
  243. border-radius: 50%;
  244. box-sizing: content-box;
  245. position: absolute;
  246. left: -4px;
  247. top: -4px;
  248. z-index: 2;
  249. }
  250. .sa-fix { // Hide corners left from animation
  251. width: 5px;
  252. height: 90px;
  253. background-color: white;
  254. position: absolute;
  255. left: 28px;
  256. top: 8px;
  257. z-index: 1;
  258. -webkit-transform: rotate(-45deg);
  259. transform: rotate(-45deg);
  260. }
  261. .sa-line {
  262. height: 5px;
  263. background-color: $green;
  264. display: block;
  265. border-radius: 2px;
  266. position: absolute;
  267. z-index: 2;
  268. &.sa-tip {
  269. width: 25px;
  270. left: 14px;
  271. top: 46px;
  272. -webkit-transform: rotate(45deg);
  273. transform: rotate(45deg);
  274. }
  275. &.sa-long {
  276. width: 47px;
  277. right: 8px;
  278. top: 38px;
  279. -webkit-transform: rotate(-45deg);
  280. transform: rotate(-45deg);
  281. }
  282. }
  283. }
  284. &.sa-custom {
  285. background-size: contain;
  286. border-radius: 0;
  287. border: none;
  288. background-position: center center;
  289. background-repeat: no-repeat;
  290. }
  291. }
  292. }
  293. /*
  294. * Animations
  295. */
  296. @mixin keyframes($animation-name) {
  297. @-webkit-keyframes #{$animation-name} {
  298. @content;
  299. }
  300. @keyframes #{$animation-name} {
  301. @content;
  302. }
  303. }
  304. @mixin animation($str) {
  305. -webkit-animation: #{$str};
  306. animation: #{$str};
  307. }
  308. // Modal animation
  309. @include keyframes(showSweetAlert) {
  310. 0% { transform: scale(0.7); -webkit-transform: scale(0.7); }
  311. 45% { transform: scale(1.05); -webkit-transform: scale(1.05); }
  312. 80% { transform: scale(0.95); -webkit-tranform: scale(0.95); }
  313. 100% { transform: scale(1); -webkit-transform: scale(1); }
  314. }
  315. @include keyframes(hideSweetAlert) {
  316. 0% { transform: scale(1); -webkit-transform: scale(1); }
  317. 100% { transform: scale(0.5); -webkit-transform: scale(0.5); }
  318. }
  319. .showSweetAlert {
  320. @include animation('showSweetAlert 0.3s');
  321. &[data-animation=none] {
  322. @include animation('none');
  323. }
  324. }
  325. .hideSweetAlert {
  326. @include animation('hideSweetAlert 0.2s');
  327. &[data-animation=none] {
  328. @include animation('none');
  329. }
  330. }
  331. // Success icon animation
  332. @include keyframes(animateSuccessTip) {
  333. 0% { width: 0; left: 1px; top: 19px; }
  334. 54% { width: 0; left: 1px; top: 19px; }
  335. 70% { width: 50px; left: -8px; top: 37px; }
  336. 84% { width: 17px; left: 21px; top: 48px; }
  337. 100% { width: 25px; left: 14px; top: 45px; }
  338. }
  339. @include keyframes(animateSuccessLong) {
  340. 0% { width: 0; right: 46px; top: 54px; }
  341. 65% { width: 0; right: 46px; top: 54px; }
  342. 84% { width: 55px; right: 0px; top: 35px; }
  343. 100% { width: 47px; right: 8px; top: 38px; }
  344. }
  345. @include keyframes(rotatePlaceholder) {
  346. 0% { transform: rotate(-45deg); -webkit-transform: rotate(-45deg); }
  347. 5% { transform: rotate(-45deg); -webkit-transform: rotate(-45deg); }
  348. 12% { transform: rotate(-405deg); -webkit-transform: rotate(-405deg); }
  349. 100% { transform: rotate(-405deg); -webkit-transform: rotate(-405deg); }
  350. }
  351. .animateSuccessTip {
  352. @include animation('animateSuccessTip 0.75s');
  353. }
  354. .animateSuccessLong {
  355. @include animation('animateSuccessLong 0.75s');
  356. }
  357. .sa-icon.sa-success.animate::after {
  358. @include animation('rotatePlaceholder 4.25s ease-in');
  359. }
  360. // Error icon animation
  361. @include keyframes(animateErrorIcon) {
  362. 0% { transform: rotateX(100deg); -webkit-transform: rotateX(100deg); opacity: 0; }
  363. 100% { transform: rotateX(0deg); -webkit-transform: rotateX(0deg); opacity: 1; }
  364. }
  365. .animateErrorIcon {
  366. @include animation('animateErrorIcon 0.5s');
  367. }
  368. @include keyframes(animateXMark) {
  369. 0% { transform: scale(0.4); -webkit-transform: scale(0.4); margin-top: 26px; opacity: 0; }
  370. 50% { transform: scale(0.4); -webkit-transform: scale(0.4); margin-top: 26px; opacity: 0; }
  371. 80% { transform: scale(1.15); -webkit-transform: scale(1.15); margin-top: -6px; }
  372. 100% { transform: scale(1); -webkit-transform: scale(1); margin-top: 0; opacity: 1; }
  373. }
  374. .animateXMark {
  375. @include animation('animateXMark 0.5s');
  376. }
  377. @include keyframes(pulseWarning) {
  378. 0% { border-color: #F8D486; }
  379. 100% { border-color: #F8BB86; }
  380. }
  381. .pulseWarning {
  382. @include animation('pulseWarning 0.75s infinite alternate');
  383. }
  384. @include keyframes(pulseWarningIns) {
  385. 0% { background-color: #F8D486; }
  386. 100% { background-color: #F8BB86; }
  387. }
  388. .pulseWarningIns {
  389. @include animation('pulseWarningIns 0.75s infinite alternate');
  390. }