11<script setup lang="ts">
22import { onMounted , onBeforeUnmount , watch , ref , nextTick , toRef , type Ref } from " vue" ;
33
4+ const COMMENT_REPOSITORY = " toothlessdev/toothlessdev.github.io" ;
5+
46const props = defineProps <{
57 theme: string ;
68}>();
@@ -9,8 +11,8 @@ const containerRef = ref<HTMLDivElement | null>(null);
911
1012function mountUtterances(theme : string ) {
1113 const container = containerRef .value ;
12- if (! container ) return ;
1314
15+ if (! container ) return ;
1416 if (container .querySelector (" iframe.utterances-frame" )) return ;
1517
1618 const script = document .createElement (" script" );
@@ -19,7 +21,7 @@ function mountUtterances(theme: string) {
1921 script .async = true ;
2022 script .crossOrigin = " anonymous" ;
2123
22- script .setAttribute (" repo" , " toothlessdev/toothlessdev-comments " );
24+ script .setAttribute (" repo" , COMMENT_REPOSITORY );
2325 script .setAttribute (" issue-term" , " pathname" );
2426 script .setAttribute (" label" , " blog-comment" );
2527 script .setAttribute (" theme" , theme );
@@ -38,12 +40,12 @@ onMounted(async () => {
3840 mountUtterances (props .theme );
3941});
4042
41- watch (toRef (props , " theme" ), (t ) => {
43+ watch (toRef (props , " theme" ), (theme ) => {
4244 if (! containerRef .value ?.querySelector (" iframe.utterances-frame" )) {
43- mountUtterances (t );
45+ mountUtterances (theme );
4446 return ;
4547 }
46- setUtterancesTheme (t );
48+ setUtterancesTheme (theme );
4749});
4850
4951onBeforeUnmount (() => {
0 commit comments