<template>
  <!-- <header class="mint-header" :class="{ 'is-fixed': fixed }">
                                <div class="mint-header-button is-left">
                                  <slot name="left"></slot>
                                </div>
                                <h1 class="mint-header-title" v-text="title"></h1>
                                <div class="mint-header-button is-right">
                                  <slot name="right"></slot>
                                </div>
                              </header> -->
  <header class="fdcHeader__wrapper" :class="{ 'fdcHeader__wrapper--fixed': fixed }">
    <!-- <div class="fdcHeader__titleWrapper">
            <slot name="title"></slot>
          </div> -->
    <div class="fdcHeader__isLeft">
      <slot name="left"></slot>
    </div>
    <div class="fdcHeader__isCenter">
      <slot name="center"></slot>
    </div>
    <div class="fdcHeader__isRight">
      <slot class="fdcHeader__isRight" name="right"></slot>
    </div>
  </header>
</template>

<script>
/**
 * fdc-header
 * @module components/header
 * @desc 顶部导航
 * @param {boolean} [fixed=false] - 固定顶部
 * @param {string} [title] - 标题
 * @param {slot} [left] - 显示在左侧区域
 * @param {slot} [right] - 显示在右侧区域
 *
 * @example
 * <mt-header title="我是标题" fixed>
 *   <mt-button slot="left" icon="back" @click="handleBack">返回</mt-button>
 *   <mt-button slot="right" icon="more"></mt-button>
 * </mt-header>
 */
export default {
  name: 'fdc-header',

  props: {
    fixed: Boolean,
    title: String
  }
};
</script>

<style lang="scss">
//header
.fdcHeader {
  &__wrapper {
    background: #fff;
    height: 88px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    &--fixed {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 100;
    }
  }
  &__link {
    line-height: 88px;
    padding: 0 20px;
    font-size: 32px;

    -webkit-tap-highlight-color: rgba(27, 107, 211, .1);
    &--primary {
      @extend .fdcHeader__link;
      color: #1B6BD2;
    }
    &--light {
      @extend .fdcHeader__link;
      color: #999999;
    }
  }
  &__icon {
    position: relative;
    display: block;
    width: 84px; // height: 100%;
    -webkit-tap-highlight-color: rgba(27, 107, 211, .1);
    background-repeat: no-repeat;
    background-position: center;
    &--back {
      background-image: url('./images/header-back.svg');
      background-size: 23px 44px;
    }
    &--item {
      background-image: url('./images/header-item.svg');
      background-size: 44px 44px;
    }
    &--more {
      background-image: url('./images/header-more.svg');
      background-size: 45px 44px;
    }
    &--search {
      background-image: url('./images/header-search.svg');
      background-size: 44px 44px;
    }
    &--add {
      background-image: url('./images/header-add.svg');
      background-size: 44px 44px;
    }
    &--map {
      background-image: url('./images/header-map.svg');
      background-size: 44px 44px;
    }
  }
  &__isLeft,
  &__isRight {
    height: 100%;
    z-index: 120;
    >div {
      display: flex;
      height: 100%;
    }
  }
  &__isRight {
    >div {
      justify-content: flex-end;
    }
  }
  &__isCenter {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    >div{
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%,-50%);
    }
  }
  &__title {
    max-width: 412px;
    font-size: 36px;
    font-weight: bold;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
    text-align: center;
    white-space: nowrap;
    &--primary {
      @extend .fdcHeader__title;
      color: #1b6bd3;
    }
  }
}
</style>
