<script setup lang="ts">
import { TkIcon } from "vitepress-theme-teek";

const props = defineProps<{
  show?: boolean; // 设为可选，防止父组件没传
  icon: string;
}>();

const scrollToBottom = () => {
  const commentEl = document.querySelector('.tk--giscus');
  if (commentEl) {
    commentEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
  } else {
    window.scrollTo({
      top: document.documentElement.scrollHeight,
      behavior: 'smooth'
    });
  }
};
</script>

<template>
  <div
      title="滚动到评论区"
      class="tk-right-bottom-button__button"
      @click.stop="scrollToBottom"
      role="button"
  >
    <TkIcon :icon="icon" aria-hidden="true" />
  </div>
</template>