Spinner.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Copyright (C) 2024 Puter Technologies Inc.
  3. *
  4. * This file is part of Puter.
  5. *
  6. * Puter is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as published
  8. * by the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. const Component = use('util.Component');
  20. export default def(class Spinner extends Component {
  21. static ID = 'ui.component.Spinner';
  22. static PROPERTIES = {
  23. size: {
  24. value: 24,
  25. },
  26. }
  27. // static RENDER_MODE = Component.NO_SHADOW;
  28. create_template ({ template }) {
  29. const size = '' + Number(this.get('size'));
  30. template.innerHTML = /*html*/`
  31. <div>
  32. <svg style="display:block; margin: 0 auto; " xmlns="http://www.w3.org/2000/svg" height="${size}" width="${size}" viewBox="0 0 24 24">
  33. <title>circle anim</title>
  34. <g fill="#212121" class="nc-icon-wrapper">
  35. <g class="nc-loop-circle-24-icon-f">
  36. <path d="M12 24a12 12 0 1 1 12-12 12.013 12.013 0 0 1-12 12zm0-22a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2z" fill="#212121" opacity=".4"></path>
  37. <path d="M24 12h-2A10.011 10.011 0 0 0 12 2V0a12.013 12.013 0 0 1 12 12z" data-color="color-2"></path>
  38. </g>
  39. <style>
  40. .nc-loop-circle-24-icon-f{
  41. --animation-duration:0.5s;
  42. transform-origin:12px 12px;
  43. animation:nc-loop-circle-anim var(--animation-duration) infinite linear
  44. }
  45. @keyframes nc-loop-circle-anim{
  46. 0%{
  47. transform:rotate(0)
  48. }
  49. 100%{
  50. transform:rotate(360deg)
  51. }
  52. }
  53. </style>
  54. </g>
  55. </svg>
  56. </div>
  57. `;
  58. }
  59. });