]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Use bootstrap loader
authorChocobozzz <me@florianbigard.com>
Fri, 10 Jun 2022 12:46:18 +0000 (14:46 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 10 Jun 2022 13:00:00 +0000 (15:00 +0200)
13 files changed:
client/src/app/+videos/+video-watch/shared/comment/video-comments.component.html
client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html
client/src/app/menu/notification.component.html
client/src/app/shared/shared-main/buttons/button.component.html
client/src/app/shared/shared-main/buttons/button.component.scss
client/src/app/shared/shared-main/loaders/index.ts
client/src/app/shared/shared-main/loaders/loader.component.html [deleted file]
client/src/app/shared/shared-main/loaders/loader.component.scss [deleted file]
client/src/app/shared/shared-main/loaders/loader.component.ts
client/src/app/shared/shared-main/loaders/small-loader.component.html [deleted file]
client/src/app/shared/shared-main/loaders/small-loader.component.ts [deleted file]
client/src/app/shared/shared-main/shared-main.module.ts
client/src/sass/bootstrap.scss

index a76379924bbac17edc9a7733aa9d315942373ed5..eca8213702b13ffd0e8137eab6422e765f0aef8e 100644 (file)
@@ -80,7 +80,7 @@
 
             <ng-template i18n #noAuthorComments>View {comment.totalReplies, plural, =1 {1 reply} other {{{ comment.totalReplies }} replies}}</ng-template>
 
-            <my-small-loader class="comment-thread-loading ms-1" [loading]="threadLoading[comment.id]"></my-small-loader>
+            <my-loader size="sm" class="comment-thread-loading ms-1" [loading]="threadLoading[comment.id]"></my-loader>
           </div>
         </my-video-comment>
 
index 2cfaad8f6b6dc7f171aae33ec5861d5fd41adecd..835d0e89f11fc1e87a98d24793e4943e5daf5763 100644 (file)
@@ -9,7 +9,7 @@
   <div class="video-info-description-more" *ngIf="completeDescriptionShown === false && video.description?.length >= 250" (click)="showMoreDescription()">
     <ng-container i18n>Show more</ng-container>
     <span *ngIf="descriptionLoading === false" class="glyphicon glyphicon-menu-down"></span>
-    <my-small-loader class="description-loading" [loading]="descriptionLoading"></my-small-loader>
+    <my-loader size="sm" class="description-loading" [loading]="descriptionLoading"></my-loader>
   </div>
 
   <div *ngIf="completeDescriptionShown === true" (click)="showLessDescription()" class="video-info-description-more">
index 2bd11c6f72c7cf4b0b42878a3de4dfcec314a042..5aa834f36073e2ed4efa579c5cb794c9defe06b6 100644 (file)
@@ -36,7 +36,7 @@
     </div>
 
     <div *ngIf="!loaded" class="loader mt-4">
-      <my-loader [loading]="!loaded"></my-loader>
+      <my-loader size="xl" [loading]="!loaded"></my-loader>
     </div>
 
     <my-user-notifications
index c0a4b21b8d93c47a6e06ec70783b5fce4ad28335..3e558bbb8dd8f809d858f2e8f38620e85c968789 100644 (file)
@@ -7,7 +7,7 @@
 </a>
 
 <ng-template #content>
-  <my-small-loader [loading]="loading"></my-small-loader>
+  <my-loader size="sm" [loading]="loading"></my-loader>
   <my-global-icon *ngIf="icon && !loading" [iconName]="icon"></my-global-icon>
 
   <span *ngIf="label" class="button-label">{{ label }}</span>
index 776f6622e6beb63abdf5b2aefa16cab9543f37d2..cdd75d525b97862c12f87ee966bbbd34aae348e3 100644 (file)
   display: inline-block;
 }
 
-my-small-loader ::ng-deep .root {
-  display: inline-block;
-  margin: 0 3px 0 0;
-  width: 20px;
-}
-
 a[class$=-button],
 span[class$=-button] {
   > span {
index a061914d5a318ff7829733086e334d14d0bb36c9..60483727c3962e2041de81cece569b85c2eb9f9a 100644 (file)
@@ -1,2 +1 @@
 export * from './loader.component'
-export * from './small-loader.component'
diff --git a/client/src/app/shared/shared-main/loaders/loader.component.html b/client/src/app/shared/shared-main/loaders/loader.component.html
deleted file mode 100644 (file)
index ca8ed06..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<div *ngIf="loading">
-  <div class="loader">
-    <div></div>
-    <div></div>
-    <div></div>
-    <div></div>
-  </div>
-</div>
diff --git a/client/src/app/shared/shared-main/loaders/loader.component.scss b/client/src/app/shared/shared-main/loaders/loader.component.scss
deleted file mode 100644 (file)
index b88b0db..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-@use '_variables' as *;
-@use '_mixins' as *;
-
-// Thanks to https://loading.io/css/ (CC0 License)
-
-.loader {
-  display: inline-block;
-  position: relative;
-  width: 50px;
-  height: 50px;
-}
-
-.loader div {
-  box-sizing: border-box;
-  display: block;
-  position: absolute;
-  width: 44px;
-  height: 44px;
-  margin: 6px;
-  border: 4px solid;
-  border-radius: 50%;
-  animation: loader 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
-  border-color: #999999 transparent transparent;
-}
-
-.loader div:nth-child(1) {
-  animation-delay: -0.45s;
-}
-
-.loader div:nth-child(2) {
-  animation-delay: -0.3s;
-}
-
-.loader div:nth-child(3) {
-  animation-delay: -0.15s;
-}
-
-@keyframes loader {
-  0% {
-    transform: rotate(0deg);
-  }
-  100% {
-    transform: rotate(360deg);
-  }
-}
index e3b1eea3a886b2eaec2ca2f4e3f6cd171b1c1087..ce8685a094586ba7360a02b4373990032d8605ee 100644 (file)
@@ -2,9 +2,27 @@ import { Component, Input } from '@angular/core'
 
 @Component({
   selector: 'my-loader',
-  styleUrls: [ './loader.component.scss' ],
-  templateUrl: './loader.component.html'
+  template: `<div *ngIf="loading" class="spinner-border" [ngStyle]="getStyle()" role="status"></div>`
 })
 export class LoaderComponent {
   @Input() loading: boolean
+  @Input() size: 'sm' | 'xl'
+
+  private readonly sizes = {
+    sm: {
+      width: '1rem',
+      height: '1rem',
+      'border-width': '.2em'
+    },
+    xl: {
+      width: '3rem',
+      height: '3rem'
+    }
+  }
+
+  getStyle () {
+    if (!this.size) return undefined
+
+    return this.sizes[this.size]
+  }
 }
diff --git a/client/src/app/shared/shared-main/loaders/small-loader.component.html b/client/src/app/shared/shared-main/loaders/small-loader.component.html
deleted file mode 100644 (file)
index 7886f89..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="root" *ngIf="loading">
-  <div class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></div>
-</div>
diff --git a/client/src/app/shared/shared-main/loaders/small-loader.component.ts b/client/src/app/shared/shared-main/loaders/small-loader.component.ts
deleted file mode 100644 (file)
index 191877f..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Component, Input } from '@angular/core'
-
-@Component({
-  selector: 'my-small-loader',
-  styleUrls: [ ],
-  templateUrl: './small-loader.component.html'
-})
-
-export class SmallLoaderComponent {
-  @Input() loading: boolean
-}
index 5629640bc59ef6f34b928185ece88535b49bde35..89f43239fb7f651bfa1037e0e873131ed352766c 100644 (file)
@@ -34,7 +34,7 @@ import { ActionDropdownComponent, ButtonComponent, DeleteButtonComponent, EditBu
 import { CustomPageService } from './custom-page'
 import { DateToggleComponent } from './date'
 import { FeedComponent } from './feeds'
-import { LoaderComponent, SmallLoaderComponent } from './loaders'
+import { LoaderComponent } from './loaders'
 import {
   ChannelsSetupMessageComponent,
   HelpComponent,
@@ -97,7 +97,6 @@ import { VideoChannelService } from './video-channel'
     FeedComponent,
 
     LoaderComponent,
-    SmallLoaderComponent,
 
     ChannelsSetupMessageComponent,
     HelpComponent,
@@ -157,7 +156,6 @@ import { VideoChannelService } from './video-channel'
     FeedComponent,
 
     LoaderComponent,
-    SmallLoaderComponent,
 
     ChannelsSetupMessageComponent,
     HelpComponent,
index 20eeeb62327225ef22e306dd056303ab29841b23..03b2e8b157489ad498d35bfdd3bb4c26e54d6d68 100644 (file)
@@ -26,17 +26,13 @@ $icon-font-path: '~@neos21/bootstrap3-glyphicons/assets/fonts/';
 @import '~bootstrap/scss/modal';
 @import '~bootstrap/scss/tooltip';
 @import '~bootstrap/scss/popover';
+@import '~bootstrap/scss/spinners';
 
 @import '~bootstrap/scss/helpers';
 @import '~bootstrap/scss/utilities/api';
 
 @import '~@neos21/bootstrap3-glyphicons/assets/stylesheets/bootstrap3-glyphicons';
 
-// Thanks https://gist.github.com/alexandrevicenzi/680147013e902a4eaa5d
-.glyphicon-refresh-animate {
-  animation: spin 0.7s infinite linear;
-}
-
 .flex-auto {
   flex: auto;
 }
@@ -45,16 +41,6 @@ $icon-font-path: '~@neos21/bootstrap3-glyphicons/assets/fonts/';
   cursor: pointer !important;
 }
 
-@keyframes spin {
-  from {
-    transform: scale(1) rotate(0deg);
-  }
-
-  to {
-    transform: scale(1) rotate(360deg);
-  }
-}
-
 // ---------------------------------------------------------------------------
 // Dropdown
 // ---------------------------------------------------------------------------