💫 (button) add animation

This commit is contained in:
2020-07-15 00:45:50 +02:00
parent 5a4acf39e8
commit 965ce9f1cb
7 changed files with 103 additions and 67 deletions

View File

@@ -1,22 +1,6 @@
<template> <template>
<div id="app"> <div id="app">
<svg <img src="@/assets/logo.svg" alt="binôme" />
xmlns="http://www.w3.org/2000/svg"
width="120"
height="120"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-users"
>
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
<circle cx="9" cy="7" r="4"></circle>
<path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
<path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
</svg>
<router-view /> <router-view />
</div> </div>
</template> </template>

16
src/assets/logo.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="120"
height="120"
viewBox="0 0 24 24"
fill="none"
stroke="#f8efba"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
<circle cx="9" cy="7" r="4"></circle>
<path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
<path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
</svg>

After

Width:  |  Height:  |  Size: 400 B

16
src/assets/pause.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrow-bar-right"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#2c3a47"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" />
<line x1="8" y1="4" x2="8" y2="20" />
<line x1="16" y1="4" x2="16" y2="20" />
</svg>

After

Width:  |  Height:  |  Size: 385 B

15
src/assets/play.svg Normal file
View File

@@ -0,0 +1,15 @@
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-caret-right"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#2c3a47"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" />
<path d="M18 15l-6-6l-6 6h12" transform="rotate(90 12 12)" />
</svg>

After

Width:  |  Height:  |  Size: 363 B

15
src/assets/stop.svg Normal file
View File

@@ -0,0 +1,15 @@
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-square"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#2c3a47"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" />
<rect x="4" y="4" width="16" height="16" rx="2" />
</svg>

After

Width:  |  Height:  |  Size: 347 B

View File

@@ -49,3 +49,14 @@ button {
a { a {
color: white; color: white;
} }
// transition
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}

View File

@@ -17,57 +17,24 @@
</section> </section>
<div class="global-time">{{ time }}</div> <div class="global-time">{{ time }}</div>
<div class="actions"> <div class="actions">
<button v-show="timeState === 'stopped'" @click="start"> <button @click="toggle">
<svg <transition name="fade" mode="out-in">
xmlns="http://www.w3.org/2000/svg" <img
class="icon icon-tabler icon-tabler-caret-right" key="play"
width="44" v-if="timeState === 'stopped'"
height="44" src="@/assets/play.svg"
viewBox="0 0 24 24" alt="play"
stroke-width="1.5" />
stroke="#2c3a47" <img
fill="none" key="pause"
stroke-linecap="round" v-if="timeState === 'started'"
stroke-linejoin="round" src="@/assets/pause.svg"
> alt="pause"
<path stroke="none" d="M0 0h24v24H0z" /> />
<path d="M18 15l-6-6l-6 6h12" transform="rotate(90 12 12)" /> </transition>
</svg>
</button> </button>
<button v-show="timeState === 'started'" @click="pause"> <button @click="clear">
<svg <img src="@/assets/stop.svg" alt="stop" />
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrow-bar-right"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#2c3a47"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" />
<line x1="8" y1="4" x2="8" y2="20" />
<line x1="16" y1="4" x2="16" y2="20" />
</svg>
</button>
<button v-show="timeState === 'started'" @click="clear">
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-square"
width="44"
height="44"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#2c3a47"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" />
<rect x="4" y="4" width="16" height="16" rx="2" />
</svg>
</button> </button>
</div> </div>
<ZoneMusic <ZoneMusic
@@ -120,8 +87,13 @@ export default defineComponent({
isDev1Turn isDev1Turn
} = useTimer() } = useTimer()
const toggle = () => {
timeState.value === 'stopped' ? start() : pause()
}
return { return {
interval, interval,
toggle,
start, start,
pause, pause,
clear, clear,
@@ -168,4 +140,11 @@ footer {
font-style: italic; font-style: italic;
font-size: 1rem; font-size: 1rem;
} }
$button-size: 44px;
button {
width: $button-size;
height: $button-size;
}
</style> </style>