]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Customize checkboxs
authorChocobozzz <me@florianbigard.com>
Wed, 20 Dec 2017 14:25:44 +0000 (15:25 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 20 Dec 2017 14:25:44 +0000 (15:25 +0100)
client/src/app/account/account-settings/account-details/account-details.component.html
client/src/app/account/account-settings/account-details/account-details.component.scss
client/src/app/account/account-videos/account-videos.component.html
client/src/app/account/account-videos/account-videos.component.scss
client/src/app/videos/+video-edit/shared/video-edit.component.html
client/src/app/videos/+video-edit/shared/video-edit.component.scss
client/src/sass/include/_mixins.scss

index 593b87e295cb710e2eadf7c56ecaded1e3af44cb..c8e1e73b03f97116770b6d63ed9583fdc8feca55 100644 (file)
@@ -1,20 +1,23 @@
 <div *ngIf="error" class="alert alert-danger">{{ error }}</div>
 
 <form role="form" (ngSubmit)="updateDetails()" [formGroup]="form">
-  <input
-    type="checkbox" id="displayNSFW"
-    formControlName="displayNSFW"
-  >
-  <label for="displayNSFW">Display videos that contain mature or explicit content</label>
-  <div *ngIf="formErrors['displayNSFW']" class="alert alert-danger">
-    {{ formErrors['displayNSFW'] }}
+  <div class="form-group">
+    <input
+      type="checkbox" id="displayNSFW"
+      formControlName="displayNSFW"
+    >
+    <label for="displayNSFW"></label>
+    <label for="displayNSFW">Display videos that contain mature or explicit content</label>
+  </div>
+
+  <div class="form-group">
+    <input
+      type="checkbox" id="autoPlayVideo"
+      formControlName="autoPlayVideo"
+    >
+    <label for="autoPlayVideo"></label>
+    <label for="autoPlayVideo">Automatically plays video</label>
   </div>
-  <br/>
-  <input
-    type="checkbox" id="autoPlayVideo"
-    formControlName="autoPlayVideo"
-  >
-  <label for="autoPlayVideo">Automatically plays video</label>
 
   <input type="submit" value="Save" [disabled]="!form.valid">
 </form>
index 1bdb19a38d8737f13065f9de3ebbd3438c845494..4e8dfde1db83d031b822cb6e1523a49ce8f3254c 100644 (file)
@@ -1,10 +1,8 @@
 @import '_variables';
 @import '_mixins';
 
-label {
-  font-size: 15px;
-  font-weight: $font-regular;
-  margin-left: 5px;
+input[type=checkbox] {
+  @include peertube-checkbox(1px);
 }
 
 input[type=submit] {
index 4f3a774bd1af89545268d9fb010dcd5571664274..f73483039b61c46fc842406a18af5c115a1628e5 100644 (file)
@@ -7,7 +7,10 @@
   (scrolledUp)="onNearOfTop()"
 >
   <div class="video" *ngFor="let video of videos; let i = index">
-    <input type="checkbox" [(ngModel)]="checkedVideos[video.id]" />
+    <div class="checkbox-container">
+      <input [id]="'video-check-' + i" type="checkbox" [(ngModel)]="checkedVideos[video.id]" />
+      <label [for]="'video-check-' + i"></label>
+    </div>
 
     <my-video-thumbnail [video]="video"></my-video-thumbnail>
 
index 0d478edd7552507dd49dbb9a11968d72ae61c397..707bd66add980e2efcc5471439636e6d97b4fcd1 100644 (file)
   min-height: 130px;
   padding-bottom: 20px;
 
-  input[type=checkbox] {
-    margin-right: 20px;
-    outline: 0;
-  }
-
   &:first-child {
     margin-top: 47px;
   }
     border-bottom: 1px solid #C6C6C6;
   }
 
+  .checkbox-container {
+    display: flex;
+    align-items: center;
+    margin-right: 20px;
+    margin-left: 12px;
+
+    input[type=checkbox] {
+      @include peertube-checkbox(2px);
+    }
+  }
+
   my-video-thumbnail {
     margin-right: 10px;
   }
index e728d8ea2da4da4bcf1dce17cf35b404f75bf7e2..4f92b4908fa0dc22adf558167bda0b078cd57b5d 100644 (file)
@@ -95,6 +95,7 @@
 
     <div class="form-group form-group-checkbox">
       <input type="checkbox" id="nsfw" formControlName="nsfw" />
+      <label for="nsfw"></label>
       <label for="nsfw">This video contains mature or explicit content</label>
     </div>
 
index ba0ca1e21aae8f1cb27a4e22b8556d05cc672c46..4f8f031cfe478a98f578f0ee3c4e94e957082e8c 100644 (file)
@@ -21,7 +21,7 @@
     display: block;
 
     &[type=checkbox] {
-      outline: 0;
+      @include peertube-checkbox(1px);
     }
   }
 
index 4a709404d9d34afae783da4674bb60c891476767..a07bd5d28b995b860c2d179f8819de734678c5e6 100644 (file)
     cursor: default;
   }
 }
+
+@mixin peertube-checkbox ($border-width) {
+  display: none;
+
+  & + label {
+    position: relative;
+    width: 18px;
+    height: 18px;
+    border: $border-width solid #000;
+    border-radius: 3px;
+    vertical-align: middle;
+    cursor: pointer;
+
+    &:after {
+      content: '';
+      position: absolute;
+      top: calc(2px - #{$border-width});
+      left: 5px;
+      width: 5px;
+      height: 12px;
+      opacity: 0;
+      transform: rotate(45deg) scale(0);
+      border-right: 2px solid #fff;
+      border-bottom: 2px solid #fff;
+    }
+  }
+
+  &:checked + label {
+    border-color: transparent;
+    background: $orange-color;
+    animation: jelly 0.6s ease;
+
+    &:after {
+      opacity: 1;
+      transform: rotate(45deg) scale(1);
+    }
+  }
+
+  & + label + label {
+    font-size: 15px;
+    font-weight: $font-regular;
+    margin-left: 5px;
+    cursor: pointer;
+  }
+}
+