feat: separate tags with and without spaces

with spaces are non-clickable
This commit is contained in:
eggy
2023-05-24 12:46:44 -04:00
parent 4502c819c3
commit 74f7bc1002
6 changed files with 26 additions and 23 deletions

View File

@@ -1,19 +1,27 @@
<script setup lang="ts">
const props = defineProps<{
name: string;
dest: string;
highlight?: boolean;
}>();
const isLinkableTag = !props.name.includes(" ");
const tagClass = [
"inline-block text-xs rounded-lg py-1 px-2 mt-1 mr-1 transition border border-pink-200 dark:border-pink-900 border-2 font-medium",
{ "bg-pink-200 dark:bg-pink-900": props.highlight },
{ "shadow-md": isLinkableTag },
];
</script>
<template>
<a :href="dest">
<div
:class="[
'inline-block text-xs rounded-lg py-1 px-2 mt-1 mr-1 transition border border-pink-200 dark:border-pink-900 border-2 shadow-md font-medium',
{ 'bg-pink-200 dark:bg-pink-900': highlight },
]"
>
<slot />
<a :href="dest" v-if="isLinkableTag">
<div :class="tagClass">
{{ name }}
</div>
</a>
<div v-else>
<div :class="tagClass">
{{ name }}
</div>
</div>
</template>