<template>
  <div>
    <b-tooltip
      :active="blocked && blockedTooltip !== ''"
      :label="blockedTooltip"
      type="is-dark"
      position="is-bottom"
    >
      <div class="square-button" :class="{ blocked: blocked }" @click="!blocked && $emit('click')">
        <BaseIcon :name="iconName" :radius="30" class="icon" />
        <span class="label"><slot /></span>
      </div>
    </b-tooltip>
  </div>
</template>

<script>
export default {
  props: {
    iconName: {
      type: String,
      required: true
    },
    label: {
      type: String,
      required: false,
      default: ''
    },
    blocked: {
      type: Boolean,
      required: false,
      default: false
    },
    blockedTooltip: {
      type: String,
      required: false,
      default: ''
    }
  }
}
</script>

<style lang="sass" scoped>
.square-button
    width: 60px
    height: 60px
    padding: 7px
    cursor: pointer
    display: flex
    flex-direction: column
    &.blocked
      cursor: not-allowed
      opacity: 0.5
    .icon
        align-self: center
        display: block
    .label
        margin-top: 4px
        font-size: 14px
        text-align: center
        color: #494949

.square-button:hover:not(.blocked)
    background: #888888
    border-radius: 5px
    .label
        color: white
</style>
