mirror of
https://github.com/dtomlinson91/anno-production-chain-renderer.git
synced 2025-12-22 06:15:45 +00:00
70 lines
1.1 KiB
Vue
70 lines
1.1 KiB
Vue
<template>
|
|
<div ref="diagram"></div>
|
|
<q-separator inset class="q-mb-sm" />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, watchEffect } from 'vue';
|
|
import mermaid from 'mermaid';
|
|
|
|
// DOM Refs
|
|
const diagram = ref<HTMLInputElement | null>(null);
|
|
|
|
// Props
|
|
const props = defineProps<{
|
|
productionChain: string;
|
|
mermaidDefinition: string;
|
|
}>();
|
|
|
|
watchEffect(() => {
|
|
if (diagram.value != null) {
|
|
mermaid.render(
|
|
props.productionChain,
|
|
props.mermaidDefinition,
|
|
(svgCode: string) => {
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
diagram.value!.innerHTML = svgCode;
|
|
}
|
|
);
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.icon-size {
|
|
width: 100px;
|
|
height: 100px;
|
|
}
|
|
|
|
.ratio-count {
|
|
font-weight: bold;
|
|
font-size: 1.5rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.efficiency-perc {
|
|
font-weight: bold;
|
|
font-size: 1.5rem;
|
|
color: $green-9 !important;
|
|
}
|
|
|
|
.electricity-container {
|
|
margin-bottom: -5px;
|
|
}
|
|
|
|
.electricity-icon {
|
|
width: 30px;
|
|
margin-bottom: -5px;
|
|
}
|
|
|
|
.icon-flex-row {
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
|
|
.icon-flex-col {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
</style>
|