add: collapsing and deletion animation

Added collapsable cards and animation for deletion and card footer
This commit is contained in:
Fiona Lena Urban 2025-02-24 21:38:45 +01:00
parent c99c243dfc
commit 7c46be6227
6 changed files with 121 additions and 29 deletions

View file

@ -23,14 +23,22 @@
</template>
<script setup lang="ts">
const initialId = crypto.randomUUID()
const randomUUID = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, char => {
const random = Math.random() * 16 | 0
const value = char === 'x' ? random : (random & 0x3 | 0x8)
return value.toString(16)
})
}
const initialId = randomUUID()
const cards = useState('cards', () => [
initialId,
])
const addCard = () => {
cards.value.push(crypto.randomUUID())
cards.value.push(randomUUID())
}
const removeCard = (uuid : string) => {