docs/.vitepress/theme/components/Block.vue
63 lines · 1417 bytes
1<!--
2 All Rights Reserved
3
4 Copyright (c) 2025 taskylizard
5
6 All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
7-->
8<script setup lang="ts">
9withDefaults(
10 defineProps<{
11 text?: string
12 type?: 'info' | 'tip' | 'warning' | 'danger'
13 link: string
14 icon?: string
15 }>(),
16 { icon: 'i-lucide-external-link', type: 'tip' }
17)
18</script>
19
20<template>
21 <component
22 :is="link ? 'a' : 'span'"
23 :href="link"
24 :class="type"
25 class="VButton flex items-center px4 py3 gap2 rounded-xl align-middle cursor-pointer w-full"
26 >
27 <div :class="icon" />
28 <slot>{{ text }}</slot>
29 </component>
30</template>
31
32<style scoped>
33.VButton {
34 text-decoration: none !important;
35}
36
37.VButton:hover,
38.VButton:active,
39.VButton:focus {
40 color: inherit !important;
41}
42
43.VButton.info {
44 color: var(--vp-badge-info-text);
45 background-color: var(--vp-badge-info-bg);
46}
47
48.VButton.tip {
49 color: var(--vp-custom-block-tip-text);
50 background-color: var(--vp-custom-block-tip-bg);
51 border: 2px solid var(--vp-custom-block-tip-border);
52}
53
54.VButton.warning {
55 color: var(--vp-badge-warning-text);
56 background-color: var(--vp-badge-warning-bg);
57}
58
59.VButton.danger {
60 color: var(--vp-badge-danger-text);
61 background-color: var(--vp-badge-danger-bg);
62}
63</style>