<template>
  <div :class="[$style.searchBox, $style['font-'+fontStyle],'input-search-box']">
    <h3 :class="$style.searchTitle">
      <slot></slot>
    </h3>
    <div :class="[$style.inputWrapper,'input-wrapper']">
      <input :value="value" type="text" placeholder="キーワードで検索する" :class="$style.input" @input="$emit('input',$event.target.value)">
      <button
        :class="$style.button"
        @click.prevent="(e) => {
          $emit('clickPre', e)
        }"
      >
        Search
      </button>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: String,
      default: '',
      require: false
    },
    fontStyle: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      modelValue: ''
    }
  }
}
</script>

<style module lang="scss">

.wrapper {
  letter-spacing: 0.04em;
  /* font-weight: bold; */
  line-height: 1.5;
  margin-top:1rem;

  @include mq-pc {
    /* font-size: 1.3rem; */
    margin: 2rem 0 1rem 0;
    // font-weight: bold;
  }

  @include mq-sp{
    font-size: 1.6rem;
    margin: 1.8rem 0 1rem 0;
  }
}
.searchBox{
  margin: 0 2rem;
  border-radius: 4px;
  overflow: hidden;
  .searchTitle{
    padding: 1.6rem 2rem;
    color: #2F2F33;
    font-size: 1.6rem;
    line-height: 1;
    font-weight: 600;
    background: #fff;
    border-bottom: 1px solid rgba(47, 47, 51, 0.1);
  }
  .input{
    font-size: 1.4rem;
    line-height: 1;
    width: 100%;
  }
  .inputWrapper {
    background-color: #fff;
    display: flex;
    width: 100%;
    padding: 1.7rem 2rem 2.3rem 2rem;
    align-items: center;
    justify-content: space-between;
  }

  .button {
    background: url("~assets/images/shared/icon-search.svg") center center
      no-repeat;
    text-indent: -9999px;
    width: 1.6rem;
    height: 1.6rem;
    background-size: 1.5rem auto;
    cursor: pointer;
  }
}
.font-small {
  font-size: 1.3rem;
}
.font-bold {
  font-weight: bold;
}
</style>
