docs/.vitepress/theme/components/Block.vue

6c425e56b35488a5b1109a8367dd18e1e771ad6f
wotaku/docs/.vitepress/theme/components/Block.vue

57 lines · 1312 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-octicon-link-external-16', type: 'tip' }
17)
18</script>
19
20<template>
21  <component
22    :target="link ? '_blank' : undefined"
23    :is="link ? 'a' : 'span'"
24    :href="link"
25    :class="type"
26    class="VButton inline-flex items-center px4 py3 gap2 rounded-md align-middle cursor-pointer"
27  >
28    <div :class="icon" />
29    <slot>{{ text }}</slot>
30  </component>
31</template>
32
33<style scoped>
34.VButton {
35  text-decoration: none !important;
36}
37
38.VButton.info {
39  color: var(--vp-badge-info-text);
40  background-color: var(--vp-badge-info-bg);
41}
42
43.VButton.tip {
44  color: var(--vp-badge-tip-text);
45  background-color: var(--vp-badge-tip-bg);
46}
47
48.VButton.warning {
49  color: var(--vp-badge-warning-text);
50  background-color: var(--vp-badge-warning-bg);
51}
52
53.VButton.danger {
54  color: var(--vp-badge-danger-text);
55  background-color: var(--vp-badge-danger-bg);
56}
57</style>