PronounsPage/components/PropertyDisplay.vue
Valentyne Stigloher b25afefc49 (fmt)
2024-10-29 10:56:32 +01:00

27 lines
535 B
Vue

<script setup lang="ts">
const props = defineProps<{
property: string;
format: (value: string) => string;
}>();
const text = useTemplateRef<HTMLSpanElement>('text');
const updateText = () => {
if (!text.value) {
return;
}
text.value.innerHTML = props.format(getComputedStyle(text.value.parentElement!).getPropertyValue(props.property));
};
onMounted(() => {
updateText();
});
const { isDark } = useDark();
watch(isDark, updateText);
</script>
<template>
<span ref="text"></span>
</template>