<template>
  <div class="search-container" :style="{ width: containerWidth, height: containerHeight }">
    <input
      type="text"
      class="search-input"
      :placeholder="placeholder"
      v-model="searchQuery"
      :style="{ height: inputHeight }"
    />
    <div class="search-icon" @click="searchBtn">
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

// 接收父组件传递过来的 props
const props = defineProps({
  containerWidth: {
    type: String,
    default: '660px' // 默认值
  },
  containerHeight: {
    type: String,
    default: '60px' // 默认值
  },
  inputHeight: {
    type: String,
    default: '40px' // 默认值
  },
  placeholder: {
    type: String,
    default: 'Search...' // 默认的占位符
  }
})

const searchBtn = () => {
  console.log('Search button clicked');
}

const searchQuery = ref('')
</script>

<style lang="scss" scoped>
.search-container {
  display: flex;
  align-items: center;
  border: 1px solid #E6E6E6;
  border-radius: 12px 0 0 12px;
  background-color: #fff;
  margin-bottom: 15px;
}

.search-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 0 10px;
  border-radius: 30px;
}

.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  cursor: pointer;
  width: 66px;
  height: 66px;
  background-image: url('../assets/img/search_Icon.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
</style>
