<script setup lang="ts">
import { Bell } from '@element-plus/icons-vue'

interface Props {
  announcements: string[]
}

defineProps<Props>()
</script>

<template>
  <div class="home-announcement">
    <el-icon><Bell /></el-icon>
    <el-carousel
      height="22px"
      direction="vertical"
      indicator-position="none"
      :autoplay="true"
      :interval="3200"
    >
      <el-carousel-item v-for="item in announcements" :key="item">
        <span>{{ item }}</span>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<style scoped>
.home-announcement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  min-width: 0;
  color: #854d0e;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(23, 35, 61, 0.03);
}

.home-announcement :deep(.el-carousel) {
  flex: 1;
  min-width: 0;
}

.home-announcement :deep(.el-carousel__container) {
  overflow: hidden;
}

.home-announcement span {
  display: block;
  overflow: hidden;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
