docs/.vitepress/theme/components/Highlight.vue
65 lines · 1045 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: #042a20;
41 color: #a8f0cc;
42 border-color: #0a5c42;
43}
44
45.warning {
46 background-color: #86680e;
47 color: #fee38b;
48 border-color: #86680e;
49}
50
51.danger {
52 background-color: #430a0a;
53 color: #fec8c8;
54 border-color: #981b1b;
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>