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

5f52e6ba0fd1abcf193bc72b0810f83dd455def0
wotaku/docs/.vitepress/theme/components/Block.vue history · blame · raw

58 lines · 1381 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 flex items-center px4 py3 gap2 rounded-xl align-middle cursor-pointer w-full"
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-custom-block-tip-text);
45  background-color: var(--vp-custom-block-tip-bg);
46  border: 2px solid var(--vp-custom-block-tip-border);
47}
48
49.VButton.warning {
50  color: var(--vp-badge-warning-text);
51  background-color: var(--vp-badge-warning-bg);
52}
53
54.VButton.danger {
55  color: var(--vp-badge-danger-text);
56  background-color: var(--vp-badge-danger-bg);
57}
58</style>