<template>
  <button
    @click="handleClick"
    class="back-button-wrapper p-2" 
    :aria-label="backButtonAccessibleText"
  >
    <div class="button-back">
      <div class="arrow-left"></div>
      <div class="box"></div>
    </div>
  </button>
</template>

<script>
export default {
  name: "buttonBack",
  props: {
    backButtonAccessibleText: {
      type: String,
      required: true,
      default: "",
    }
  },
  methods: {
    handleClick() {
      this.$emit('click-event');
    }
  }
};
</script>

<style lang="scss">
.back-button-wrapper {
  border: none;
  background: transparent;
  text-decoration: none;
  border-bottom: none;
  // Account for padding while still being inline with heading text (for cases where text wraps to 2 lines)
  margin-bottom: -.75rem;
  margin-top: -.75rem;

  .button-back {
    display: inline-flex;
    position: relative;
    height: 18px;
    width: 23px;
    overflow: hidden;
     // Account for padding while still being inline with heading text (for cases where text wraps to 2 lines)
    margin-bottom: -2px;
    .arrow-left {
      position: absolute;
      width: 18px;
      height: 18px;
      left: 4px;
      background-color: $gray-550;
      transform: rotate(45deg);
      border-radius: 4px;
    }
    .box {
      content: "";
      position: absolute;
      background: $gray-550;
      height: 100%;
      width: 11px;
      display: flex;
      justify-content: center;
      align-items: center;
      left: 12px;
      border-radius: 5px;
      &:before, &:after {
        position: absolute;
        left: 1px;
        top: 3px;
        content: " ";
        height: 12px;
        width: 2px;
        background-color: $white;
        border-radius: 2px;
      }
      &:before {
        transform: rotate(45deg);
      }
      &:after {
        transform: rotate(-45deg);
      }
    }
  }
}
</style>
