|
| 1 | +<script setup lang="ts"> |
| 2 | +const slots = useSlots() |
| 3 | +const children = slots.default?.()[0].children |
| 4 | +const key = children?.default?.()[0].children[0].children |
| 5 | +
|
| 6 | +const simplifiedKey = key.replace('!', '') |
| 7 | +
|
| 8 | +const typesOfQuotes = { |
| 9 | + '!NOTE': { |
| 10 | + class: 'bg-blue-100 border-blue-500 text-blue-900', |
| 11 | + class2: 'border-l-4 border-blue-500 text-blue-500', |
| 12 | + icon: 'carbon:information', |
| 13 | + }, |
| 14 | + '!TIP': { |
| 15 | + class: 'bg-lime-100 border-lime-500 text-lime-900', |
| 16 | + class2: 'border-l-4 border-lime-500 text-lime-500', |
| 17 | + icon: 'carbon:idea', |
| 18 | + }, |
| 19 | + '!IMPORTANT': { |
| 20 | + class: 'bg-purple-100 border-purple-500 text-purple-900', |
| 21 | + class2: 'border-l-4 border-purple-500 text-purple-500', |
| 22 | + icon: 'carbon:chat', |
| 23 | + }, |
| 24 | + '!WARNING': { |
| 25 | + class: 'bg-yellow-100 border-yellow-500 text-yellow-900', |
| 26 | + class2: 'border-l-4 border-yellow-500 text-yellow-500', |
| 27 | + icon: 'carbon:warning-alt', |
| 28 | + }, |
| 29 | + '!CAUTION': { |
| 30 | + class: 'bg-red-100 border-red-500 text-red-900', |
| 31 | + class2: 'border-l-4 border-red-500 text-red-500', |
| 32 | + icon: 'carbon:warning-hex', |
| 33 | + }, |
| 34 | +} |
| 35 | +</script> |
| 36 | + |
| 37 | +<template> |
| 38 | + <div class="px-4 py-2 bg-white/5 my-5" :class="typesOfQuotes[key]?.class2"> |
| 39 | + <div class="flex items-center gap-2 font-bold"> |
| 40 | + <template v-if="typesOfQuotes[key]?.icon"> |
| 41 | + <Icon class="w-6 h-6" :name="typesOfQuotes[key]?.icon" /> |
| 42 | + </template> |
| 43 | + <div> |
| 44 | + {{ simplifiedKey }} |
| 45 | + </div> |
| 46 | + </div> |
| 47 | + <div class="text-white"> |
| 48 | + <slot /> |
| 49 | + </div> |
| 50 | + </div> |
| 51 | +</template> |
0 commit comments