Complete "Client Side Routing"

This commit is contained in:
2025-04-03 21:12:18 +02:00
parent 1c2fdc1a66
commit e24b12ecd8
3 changed files with 94 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
<script setup lang="ts">
const props = defineProps<{
contact: Pick<ContactRecord, "favorite">
}>();
const favorite = computed(() => props.contact.favorite);
const ariaLabel = computed(() => favorite.value ? "Remove from favorites" : "Add to favorites");
</script>
<template>
<form method="post">
<button
:aria-label=ariaLabel
name="favorite"
:value="() => favorite ? 'false': 'true'"
>
{{ favorite ? "★" : "☆" }}
</button>
</form>
</template>
<style scoped>
</style>