docs/.vitepress/theme/components/Highlight.vue

ba4f23d3bab9e2bb3b8efdb22317c8cc8f353ec5
wotaku/docs/.vitepress/theme/components/Highlight.vue history · blame · raw

65 lines · 1282 bytes

 1<template>
 2  <span class="highlight-pill" :class="[variant, { 'has-link': linked }]">
 3    <slot />
 4    <span v-if="linked" class="i-mdi-arrow-top-right-thick link-icon"></span>
 5  </span>
 6</template>
 7
 8<script setup>
 9defineProps({
10  variant: {
11    type: String,
12    default: 'default'
13  },
14  linked: {
15    type: String,
16    default: null
17  }
18})
19</script>
20
21<style scoped>
22.highlight-pill {
23  display: inline-block;
24  position: relative;
25  padding: 0 0.25em;
26  border-radius: 4px;
27  font-size: 0.9em;
28  font-weight: 500;
29  line-height: 1.5;
30  white-space: nowrap;
31  vertical-align: baseline;
32  border: 1px solid;
33}
34
35.has-link {
36  margin-right: 0.5em;
37}
38
39.default {
40  background-color: var(--vp-custom-block-tip-bg);
41  color: var(--vp-custom-block-tip-text);
42  border-color: var(--vp-custom-block-tip-border);
43}
44
45.warning {
46  background-color: var(--vp-custom-block-warning-bg);
47  color: var(--vp-custom-block-warning-text);
48  border-color: var(--vp-custom-block-warning-border);
49}
50
51.danger {
52  background-color: var(--vp-custom-block-danger-bg);
53  color: var(--vp-custom-block-danger-text);
54  border-color: var(--vp-custom-block-danger-border);
55}
56
57.link-icon {
58  position: absolute;
59  top: 0;
60  right: 0;
61  transform: translate(50%, -50%);
62  font-size: 0.9em;
63  opacity: 0.9;
64}
65</style>