<script setup lang="ts">
const props = defineProps<{
  smallMode?: boolean
  defaultClass?: string
  class?: string
}>()

const defaultClass = props.defaultClass ?? 'm-2 flex gap-2 px-2'
const additionalClass = props.class ?? ''
const btnClass = props.smallMode ? '[&_button]:w-7 [&_button]:h-7 [&_button]:2xl:w-8 [&_button]:2xl:h-9 [&_button]:!p-0' : ''

type ClickType = 'back' | 'draft' | 'print'

const emit = defineEmits<{
  (e: 'click', type: ClickType): void
}>()

function onClick(type: ClickType) {
  emit('click', type)
}
</script>

<template>
  <div :class="`${defaultClass} ${additionalClass} ${btnClass}`">
    <div>
      <Button class="bg-gray-400" type="button" @click="onClick('back')">
        <Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
        Back
      </Button>
    </div>
    <div>
      <Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')">
        <Icon name="i-lucide-file" class="me-2" />
        Edit
      </Button>
    </div>
    <div>
      <Button class="bg-primary" type="button" @click="onClick('print')">
        <Icon name="i-lucide-printer" class="me-2 align-middle" />
        Print
      </Button>
    </div>
  </div>
</template>
