<template lang="pug">
  .header(:style="{ background: showBackground }")
    back-button.left-button(v-if="!noLeft" :color="defaultTextColor" @click="backClick") {{lText}}
    span.title(:style="{color: defaultTextColor}")
      slot
    button.right-button(:style="{color: defaultTextColor}" v-if="rText")
</template>

<script>
import BackButton from "./back-button.vue";

export default {
  components: {
    BackButton
  },
  props: ["tColor", "lText", "rText", "title", "noLeft", 'background'],
  data() {
    return {

    }
  },
  computed: {
    defaultTextColor() {
      return this.tColor || "white";
    },
    showBackground() {
      return this.background || this.$headerBackground || 'transparent'
    },
  },
  methods: {
    backClick() {
      this.$emit("backClick");
    }
  }
};
</script>

<style scoped lang="less">
.header {
  position: relative;
  text-align: center;
  height: 40px;
  line-height: 40px;
  width: 100%;

  .title {
    font-size: 14px;
  }

  button {
    position: absolute;
    height: 40px;
    margin: 0;
    padding: 0 10px;
    background: transparent;
    cursor: pointer;
  }

  .left-button {
    left: 0;
  }

  .right-button {
    right: 0;
  }
}
</style>
