<template>
  <ul class="trifle-dropdown-wrap">
    <li class="trifle-dropdown">
        <a class="init-bottom">{{ title }}</a>
        <ul class="trifle-dropdown-menu">
            <slot />
        </ul>
    </li>
  </ul>
</template>

<script>
export default {
  name: 'DropDown',
  props: {
    title: {
      type: String,
      required: true,
    },
  }
}
</script>

<style lang="scss" scoped>
@import '../const/variable.scss';

.trifle-dropdown-wrap {
    position: relative;
    width: 100%;
    height: 50px;
    max-width: 1000px;
    margin: 0 auto;
    *zoom: 1;

    li {
      line-height: 50px;
      background: palette(white, base);

      &:hover {
        background: palette(white, base);
        -webkit-transition: all .5s;
        transition: all .5s;
      }

      a {
        display: block;
        color: palette(blue, base);
      }

      .trifle-dropdown-menu {
        visibility: hidden;
        opacity: 0;
        z-index: 1;
      }
    }

    .trifle-dropdown {
      position: relative;

      .init-bottom {
        padding: 5px 10px;

        &:hover {
          color: palette(blue, light);
        }
      }

      .trifle-dropdown-menu {
        position: absolute;
        top: 40px;
        width: 100%;
        background: palette(blue, base);
        -webkit-transition: all .2s ease;
        transition: all .2s ease;
      }

      &:hover {
        .trifle-dropdown-menu {
          top: 50px;
          visibility: visible;
          opacity: 1;
        }
      }
    }
}

/* 下矢印 */
.init-bottom:after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 0 3px 15px;
    border-right: 1px solid palette(blue, base);
    border-bottom: 1px solid palette(blue, base);
    -webkit-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    transform: rotate(45deg);
}
</style>
