Add transition when showing comment form.
authorAlexandre Segura <mex.zktk@gmail.com>
Tue, 14 Mar 2017 16:33:12 +0100
changeset 431 39893bc3340a
parent 430 34760e26cc78
child 432 597cc594e753
Add transition when showing comment form.
src/iconolab/templates/partials/comment_form.html
src_js/iconolab-bundle/src/iconolab.scss
--- a/src/iconolab/templates/partials/comment_form.html	Tue Mar 14 15:35:42 2017 +0100
+++ b/src/iconolab/templates/partials/comment_form.html	Tue Mar 14 16:33:12 2017 +0100
@@ -58,16 +58,20 @@
     </div>
   </div>
 
-  <fieldset v-show="active" class="form-group form-group-sm">
-    <textarea class="form-control input-sm"
-      name="{{ comment_form.comment.name }}"
-      id="id_{{ comment_form.comment.name }}"
-      placeholder="Ajouter mon commentaire..."></textarea>
-  </fieldset>
+  <transition name="slide-down">
+    <div v-show="active">
+      <fieldset class="form-group form-group-sm">
+        <textarea class="form-control input-sm"
+          name="{{ comment_form.comment.name }}"
+          id="id_{{ comment_form.comment.name }}"
+          placeholder="Ajouter mon commentaire..."></textarea>
+      </fieldset>
 
-  <button v-show="active" type="submit" class="btn btn-xs btn-primary">Commenter</button>
-  <a v-show="active" href="#" v-on:click.prevent="active = null" class="text-muted" style="margin-left: 5px;">
-    <small>Annuler</small>
-  </a>
+      <button type="submit" class="btn btn-xs btn-primary">Commenter</button>
+      <a href="#" v-on:click.prevent="active = null" class="text-muted" style="margin-left: 5px;">
+        <small>Annuler</small>
+      </a>
+    </div>
+  </transition>
 
 </form>
--- a/src_js/iconolab-bundle/src/iconolab.scss	Tue Mar 14 15:35:42 2017 +0100
+++ b/src_js/iconolab-bundle/src/iconolab.scss	Tue Mar 14 16:33:12 2017 +0100
@@ -482,3 +482,17 @@
         margin-bottom: 20px;
     }
 }
+
+.slide-down-enter-active {
+  animation: slide-down-in .6s;
+}
+@keyframes slide-down-in {
+  0% {
+    max-height: 0;
+    opacity: 0;
+  }
+  100% {
+    max-height: 1000px;
+    opacity: 1;
+  }
+}