First commit
This commit is contained in:
27
frontend/app/components/SymbolText.vue
Normal file
27
frontend/app/components/SymbolText.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{ text?: string }>()
|
||||
|
||||
/** Runs of {symbols} render through ManaCost; everything else stays text. */
|
||||
const parts = computed(() => (props.text ?? '')
|
||||
.split(/((?:\{[^}]+\})+)/)
|
||||
.filter(Boolean))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="symbol-text">
|
||||
<template v-for="(part, index) in parts" :key="index">
|
||||
<ManaCost v-if="part.startsWith('{')" :cost="part" />
|
||||
<template v-else>{{ part }}</template>
|
||||
</template>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.symbol-text {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.symbol-text :deep(.mana-cost) {
|
||||
vertical-align: -0.15em;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user