<template>
  <div :class="['message-input-button', isH5 && 'message-input-button-h5']">
    <button
      v-if="enableSend"
      class="message-input-button-cont"
      data-type="text"
      @click="sendMessage"
      :disabled="false"
    >
      <p class="message-input-button-hover">
        {{ $t('TUIChat.按Enter发送，Ctrl+Enter换行') }}
      </p>
      {{ $t('发送') }}
    </button>
  </div>
</template>
<script setup lang="ts">
import { defineProps, toRefs, defineEmits, ref } from 'vue';
const props = defineProps({
  enableSend: {
    type: Boolean,
    default: true
  },
  messages: {
    type: Array,
    default: () => []
  },
  isH5: {
    type: Boolean,
    default: true
  }
});
const { enableSend } = toRefs(props);
const emits = defineEmits(['sendMessage']);
const sendMessage = () => {
  emits('sendMessage');
};
</script>
<style scoped lang="scss">
@import url('../../../styles/common.scss');
@import url('../../../styles/icon.scss');
.message-input-button {
  position: absolute;
  bottom: 20Px;
  right: 20Px;
  &-h5 {
    position: static;
  }
  &-cont {
    padding: 8Px 20Px;
    border-radius: 4Px;
    border: none;
    font-size: 14Px;
    text-align: center;
    line-height: 20Px;
    font-weight: 400;
    background: #006eff;
    color: #ffffff;
    letter-spacing: 0;
    cursor: pointer;
  }
  &:hover {
    .message-input-button-hover {
      display: flex;
    }
  }
  &-hover {
    display: none;
    justify-content: center;
    align-items: center;
    position: absolute;
    right: 120%;
    word-break: keep-all;
    height: 30Px;
    white-space: nowrap;
    top: 0;
    bottom: 0;
    margin: auto 0;
    padding: 5Px 10Px;
    border-radius: 3Px;
    background: #000000;
    color: #ffffff;
    opacity: 0.3;

    &::before {
      content: '';
      position: absolute;
      width: 0;
      height: 0;
      right: -20Px;
      border: 10Px solid transparent;
      border-left: 10Px solid #000000;
    }
  }
}
</style>
