Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. // Usage
  2. // Only tested with normal size button, will update if required
  3. <my-loader [loading]="loading" defaultText="LOGIN"></my-loader>
  4.  
  5. // loader.ts
  6. import { Component, Input } from 'angular2/core';
  7.  
  8. @Component({
  9. selector: 'my-loader',
  10. template: `
  11. <div class="myLoader" [hidden]="!loading">Loading ...</div>
  12. <span [hidden]="loading">{{defaultText}}</span>
  13. `
  14. })
  15.  
  16. export class MyLoader {
  17. @Input() loading: boolean;
  18. @Input() defaultText: string;
  19. }
  20.  
  21. // loader.scss
  22. // Loader
  23. .button .myLoader {
  24. top: -23px;
  25. }
  26.  
  27. .myLoader:before,
  28. .myLoader:after,
  29. .myLoader {
  30. border-radius: 50%;
  31. width: 0.9em;
  32. height: 0.9em;
  33. -webkit-animation-fill-mode: both;
  34. animation-fill-mode: both;
  35. -webkit-animation: load7 1.5s infinite ease-in-out;
  36. animation: load7 1.5s infinite ease-in-out;
  37. }
  38. .myLoader {
  39. font-size: 10px;
  40. margin: 0 auto;
  41. position: relative;
  42. text-indent: -9999em;
  43. -webkit-transform: translateZ(0);
  44. -ms-transform: translateZ(0);
  45. transform: translateZ(0);
  46. -webkit-animation-delay: -0.16s;
  47. animation-delay: -0.16s;
  48. }
  49.  
  50. .myLoader:before {
  51. left: -1.9em;
  52. -webkit-animation-delay: -0.32s;
  53. animation-delay: -0.32s;
  54. }
  55.  
  56. .myLoader:after {
  57. left: 1.9em;
  58. }
  59.  
  60. .myLoader:before,
  61. .myLoader:after {
  62. content: '';
  63. position: absolute;
  64. top: 0;
  65. }
  66.  
  67. @-webkit-keyframes load7 {
  68. 0%,
  69. 80%,
  70. 100% {
  71. box-shadow: 0 2.5em 0 -1.3em $background-color;
  72. }
  73. 40% {
  74. box-shadow: 0 2.5em 0 0 $background-color;
  75. }
  76. }
  77.  
  78. @keyframes load7 {
  79. 0%,
  80. 80%,
  81. 100% {
  82. box-shadow: 0 2.5em 0 -1.3em $background-color;
  83. }
  84. 40% {
  85. box-shadow: 0 2.5em 0 0 $background-color;
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement