mastered vuejs transitions

This commit is contained in:
2019-09-24 16:49:14 +02:00
parent 13479074b4
commit 665a5154d7
4 changed files with 104 additions and 61 deletions
+46 -52
View File
@@ -4,6 +4,7 @@
@import './base/grid-flex'; @import './base/grid-flex';
@import './base/layout'; @import './base/layout';
@import './base/fonts'; @import './base/fonts';
@import './base/transitions';
body{ body{
@@ -55,62 +56,71 @@ section[role="main-content"]{
} }
footer[role="tools"]{ footer[role="tools"]{
$list-item-h: 5.3em;
#history{ #history{
z-index: 8;
background-color: $or; background-color: $or;
padding:1.2em $side-padding; padding:1.2em $side-padding;
} }
#results{ #results{
z-index: 9;
background-color: $gris; background-color: $gris;
max-height: 50vh;
padding:1.2em $side-padding; padding:1.2em $side-padding;
section.col-1{ max-height: $list-item-h * 3;
@include accordeon-transition($list-item-h * 3);
>header{
.results-count{ .results-count{
font-size: 0.756em; font-size: 0.756em;
} }
} }
.results-list{ .results-list{
overflow-x: hidden; overflow-x: hidden;
.wrapper{ .wrapper{
height:100%; height:100%;
overflow-y: auto; overflow-y: auto;
width:calc(100% + 1em); width:calc(100% + 1em);
padding-right: 1em; padding-right: 1em;
>ul{ >ul{
padding:0; padding:0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
}
} }
li.result{ }
flex-basis: percentage(2/$default_sum); li.result{
height: 5.3em; box-sizing: border-box;
flex-basis: percentage(2/$default_sum);
height: $list-item-h;
overflow: hidden;
padding-bottom: 1em;
padding-right: 0.7em;
article{
max-height: 100%;
overflow: hidden; overflow: hidden;
margin-bottom: 1em;
padding-right: 0.7em;
box-sizing: border-box;
} }
article.result.item{ }
header{ article.result.item{
h1{ header{
font-size: 0.882em; h1{
font-weight: normal; font-size: 0.882em;
margin:0 0 0.5em 0; font-weight: normal;
} margin:0 0 0.5em 0;
} }
.extract{ }
p{ .extract{
font-size: 0.882em; p{
margin:0; font-size: 0.882em;
} margin:0;
code{ }
background-color: lighten(desaturate($rouge,20%), 20%); code{
} background-color: lighten(desaturate($rouge,20%), 20%);
} }
} }
} }
} }
}
#footer-bottom{ #footer-bottom{
z-index: 10;
padding:0 $side-padding; padding:0 $side-padding;
background-color: $bleuroi; background-color: $bleuroi;
&>*{ &>*{
@@ -143,6 +153,7 @@ footer[role="tools"]{
font-weight: 400; font-weight: 400;
text-transform: uppercase; text-transform: uppercase;
cursor: pointer; cursor: pointer;
@include fade-transition;
} }
} }
} }
@@ -219,20 +230,3 @@ span.mdi-loading{
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-timing-function: linear; animation-timing-function: linear;
} }
// _ _ _ _
// | |_ _ _ __ _ _ _ __(_) |_(_)___ _ _ ___
// | _| '_/ _` | ' \(_-< | _| / _ \ ' \(_-<
// \__|_| \__,_|_||_/__/_|\__|_\___/_||_/__/
.fade-roll-enter-active{
transition: all .3s ease-in-out;
}
.fade-roll-leave-active{
transition: all .8s ease;
}
.fade-roll-enter, .fade-roll-leave-to{
opacity:0;
// height:1px;
}
+47
View File
@@ -0,0 +1,47 @@
// _ _ _ _
// | |_ _ _ __ _ _ _ __(_) |_(_)___ _ _ ___
// | _| '_/ _` | ' \(_-< | _| / _ \ ' \(_-<
// \__|_| \__,_|_||_/__/_|\__|_\___/_||_/__/
@mixin accordeon-transition($h){
&.accordeon-enter,
&.accordeon-leave-to{
// opacity: 0;
height:0.01vh;
padding-top: 0;
padding-bottom: 0;
// transform: translateY(100%);
// transform: translate3d(0, 100%, 0);
}
&.accordeon-enter-to,
&.accordeon-leave{
// opacity:1;
height:$h;
// transform: translateY(0%);
// transform: translate3d(0, 0, 0);
}
&.accordeon-enter-active{
transition: all 300ms ease-in-out;
}
&.accordeon-leave-active{
transition: all 200ms ease-in-out;
}
}
@mixin fade-transition() {
&.fade-enter,
&.fade-leave-to{
opacity: 0;
}
&.fade-enter-to,
&.fade-leave{
opacity:1;
}
&.fade-enter-active{
transition: all 300ms ease-in-out;
}
&.fade-leave-active{
transition: all 200ms ease-in-out;
}
}
+10 -8
View File
@@ -8,14 +8,16 @@
</li> </li>
<li class="results"> <li class="results">
<div class="wrapper"> <div class="wrapper">
<span <transition name="fade" appear>
v-if="resultsItems.length && !resultsOpened" <span
title="Ouvrir les resultats" v-if="resultsItems.length && !resultsOpened"
@click.prevent="openResults" title="Ouvrir les resultats"
@keydown.enter.prevent="openResults" @click.prevent="openResults"
> @keydown.enter.prevent="openResults"
Resultas >
</span> Resultas
</span>
</transition>
</div> </div>
</li> </li>
</ul> </ul>
+1 -1
View File
@@ -1,5 +1,5 @@
<template> <template>
<transition name="fade-roll"> <transition name="accordeon" appear>
<div <div
v-if="opened" v-if="opened"
id="results" id="results"