<script lang="ts" setup>
import { ref } from 'vue'
import { ITalkRecordExtraGroupNotice, ITalkRecord } from '@/types/chat'

defineProps<{
  extra: ITalkRecordExtraGroupNotice
  data: ITalkRecord
  maxWidth?: Boolean
}>()

let show = ref(false)
</script>
<template>
  <section
    class="im-message-group-notice pointer"
    @click="show = !show"
    :class="{
      left: data.float === 'left',
      right: data.float === 'right'
    }"
  >
    <div class="title">
      <!-- <n-tag :bordered="false" size="small" type="primary"> 群公告 </n-tag>
      《{{ extra.title }}》 -->
      <text>群公告</text>
    </div>
    <div class="title" :class="{ ellipsis: !show }">
      {{ extra.content }}
    </div>
  </section>
</template>

<style lang="less" scoped>
.im-message-group-notice {
  max-width: 500px;
  min-height: 10px;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--im-message-border-color);
  user-select: none;
  background-color: #fff;

  .title {
    line-height: 44rpx;
    font-size: 32rpx;
    // overflow: hidden;
    // text-overflow: ellipsis;
    // white-space: nowrap;
    font-weight: 400;
    margin-bottom: 5px;
    position: relative;
  }

  .content {
    font-size: 13px;
    color: #a8a8a8;
    line-height: 24px;
    white-space: pre-wrap;

    &.ellipsis {
      height: 24px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  &.left {
    background-color: #fff;
    border-radius: 0 16rpx 16rpx 16rpx;
  }

  &.right {
    background-color: #46299d;
    border-radius: 16rpx 0 16rpx 16rpx;
    .title {
      color: #fff;
    }
  }
}
</style>
