docs/.vitepress/theme/components/Button.vue

55d3763f59937dbfc83214480c98171119b08f83
wotaku/docs/.vitepress/theme/components/Button.vue

52 lines · 1268 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 :target="link ? '_blank' : undefined" :is="link ? 'a' : 'span'" :href="link" :class="type"
22    class="VButton px4 py3 mt2 gap2 block flex items-center rounded-md">
23    <div :class="icon" />
24    <slot>{{ text }}</slot>
25  </component>
26</template>
27
28<style scoped>
29.VButton {
30  text-decoration: none !important;
31}
32
33.VButton.info {
34  color: var(--vp-badge-info-text);
35  background-color: var(--vp-badge-info-bg);
36}
37
38.VButton.tip {
39  color: var(--vp-badge-tip-text);
40  background-color: var(--vp-badge-tip-bg);
41}
42
43.VButton.warning {
44  color: var(--vp-badge-warning-text);
45  background-color: var(--vp-badge-warning-bg);
46}
47
48.VButton.danger {
49  color: var(--vp-badge-danger-text);
50  background-color: var(--vp-badge-danger-bg);
51}
52</style>