💫 (interval) add animation to plus and minus
This commit is contained in:
15
src/assets/minus.svg
Normal file
15
src/assets/minus.svg
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="icon icon-tabler icon-tabler-minus"
|
||||||
|
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="5" y1="12" x2="19" y2="12" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 335 B |
16
src/assets/plus.svg
Normal file
16
src/assets/plus.svg
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="icon icon-tabler icon-tabler-plus"
|
||||||
|
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="12" y1="5" x2="12" y2="19" />
|
||||||
|
<line x1="5" y1="12" x2="19" y2="12" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 376 B |
@@ -1,41 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="interval-input">
|
<div class="interval-input">
|
||||||
|
<transition name="fade" mode="out-in">
|
||||||
<button v-show="editable" @click="minus">
|
<button v-show="editable" @click="minus">
|
||||||
<svg
|
<img key="minus" src="@/assets/minus.svg" alt="minus" />
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="icon icon-tabler icon-tabler-minus"
|
|
||||||
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="5" y1="12" x2="19" y2="12" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
</button>
|
||||||
|
</transition>
|
||||||
|
<transition name="fade" mode="out-in">
|
||||||
<h2>{{ label }}</h2>
|
<h2>{{ label }}</h2>
|
||||||
|
</transition>
|
||||||
|
<transition name="fade" mode="out-in">
|
||||||
<button v-show="editable" @click="plus">
|
<button v-show="editable" @click="plus">
|
||||||
<svg
|
<img key="plus" src="@/assets/plus.svg" alt="plus" />
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="icon icon-tabler icon-tabler-plus"
|
|
||||||
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="12" y1="5" x2="12" y2="19" />
|
|
||||||
<line x1="5" y1="12" x2="19" y2="12" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
</button>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -48,18 +25,16 @@ export default defineComponent({
|
|||||||
props: {
|
props: {
|
||||||
editable: { type: Boolean, required: true }
|
editable: { type: Boolean, required: true }
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup() {
|
||||||
const { interval, minInterval, minus, plus } = useInterval()
|
const { interval, minInterval, minus, plus } = useInterval()
|
||||||
|
|
||||||
const label = computed(() => {
|
const label = computed(() => {
|
||||||
if (interval.value > 1) {
|
if (interval.value > 1) {
|
||||||
return props.editable
|
return `${interval.value} minute session`
|
||||||
? `${interval.value} minutes`
|
|
||||||
: `${interval.value} minute session`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interval.value === minInterval) {
|
if (interval.value === minInterval) {
|
||||||
return props.editable ? '30 seconds' : '30 second session'
|
return '30 second session'
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${interval.value} minute`
|
return `${interval.value} minute`
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ a {
|
|||||||
|
|
||||||
.fade-enter-active,
|
.fade-enter-active,
|
||||||
.fade-leave-active {
|
.fade-leave-active {
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.25s ease;
|
||||||
}
|
}
|
||||||
.fade-enter,
|
.fade-enter,
|
||||||
.fade-leave-to {
|
.fade-leave-to {
|
||||||
|
|||||||
@@ -24,12 +24,16 @@
|
|||||||
v-if="timeState === 'stopped'"
|
v-if="timeState === 'stopped'"
|
||||||
src="@/assets/play.svg"
|
src="@/assets/play.svg"
|
||||||
alt="play"
|
alt="play"
|
||||||
|
width="44px"
|
||||||
|
height="44px"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
key="pause"
|
key="pause"
|
||||||
v-if="timeState === 'started'"
|
v-if="timeState === 'started'"
|
||||||
src="@/assets/pause.svg"
|
src="@/assets/pause.svg"
|
||||||
alt="pause"
|
alt="pause"
|
||||||
|
width="44px"
|
||||||
|
height="44px"
|
||||||
/>
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
</button>
|
</button>
|
||||||
@@ -140,11 +144,4 @@ 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>
|
||||||
|
|||||||
Reference in New Issue
Block a user