-
-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathActualBoxes.vue
More file actions
44 lines (40 loc) · 957 Bytes
/
ActualBoxes.vue
File metadata and controls
44 lines (40 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script setup lang="ts">
import { ref } from "vue"
import { vAutoAnimate } from "../../../../src"
const numbers = ref<number[]>(new Array(50).fill("").map((_, i) => i))
const randomize = () => {
numbers.value.sort(() => (Math.random() > 0.5 ? 1 : -1))
}
</script>
<template>
<div class="example boxes-example">
<div class="boxes" v-auto-animate="{ duration: 500 }">
<div
class="box"
v-for="number in numbers"
:key="number"
v-text="number"
/>
</div>
<button class="button button--alt" @click="randomize">Randomize</button>
</div>
</template>
<style scoped>
.boxes {
display: flex;
flex-wrap: wrap;
margin: 2em -0.25em 2em -0.25em;
}
.box {
box-sizing: border-box;
width: calc(10% - 0.5em);
margin: 0.25em;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.875em;
font-weight: 300;
aspect-ratio: 1;
border: 1px solid var(--gray-l);
}
</style>