<template>
  <select
    id="name"
    :name="name"
    @change="change"
  >
    <option value="">
      선택해주세요
    </option>
    <option
      v-for="option in options"
      :key="option.text"
      :value="option.id"
    >
      {{ option.text }}
    </option>
  </select>
</template>

<script>
export default {
  name: 'CuSelect',
  props: {
    options: {
      type: Array,
      default () {
        return []
      }
    },
    name: {
      type: String,
      default: ''
    }
  },
  methods: {
    change (e) {
      this.$emit('change', e)
    }
  }
}
</script>

<style lang="scss" scoped>
  @import "../styles/colors.scss";

  select {
    display: block;
    width: 100%;
    border: 1px solid $silver;
    padding: 1rem 1.4rem;
    font-size: 1.5rem;
    color: $black;
    -webkit-appearance: none;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    border-radius: 3px;
    background: $white url("../assets/icon-arrow-down.svg") no-repeat right 1.6rem center;
    &:disabled {
      color: $white;
      background: $border-gray url("../assets/icon-arrow-down.svg") no-repeat right 1.6rem center;
    }
    &:focus {
      outline: none;
    }
  }
</style>
