<template>
  <div class="layout">
    <header class="header">
      <div class="header__container">
        <Icon class="cursor-pointer w-6 h-6" name="lucide:arrow-left" @click="previewStep" />

        <h3>
          Шаг {{ currentCheckoutStep?.step }} из {{ checkoutSteps?.length }}
          &nbsp;&bull;&nbsp;
          {{ t(`checkoutSteps.${currentCheckoutStep?.title}`) }}
        </h3>

        <Icon class="cursor-pointer w-6 h-6" name="lucide:arrow-right" @click="nextStep" />
      </div>
    </header>

    <main class="main">
      <UContainer class="container">
        <slot />
      </UContainer>
    </main>
  </div>
</template>

<script setup lang="ts">
import { useCheckout } from '../composables/useCheckout'

const { previewStep, nextStep, currentCheckoutStep, checkoutSteps } = useCheckout()
const { t } = useI18n()
</script>

<style lang="scss" scoped>
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  --ui-container: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 54px;

  &__container {
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    padding: 0 16px;
  }
}

.main {
  flex: 1;
  margin-top: 54px;
}
</style>
