<script setup lang="ts">
const props = defineProps({
  data: Object
})

const activeName = ref('shipmentStatus')

const handleTabClick = (name: string) => {
  activeName.value = name
}
</script>

<template>
  <div class="transport-step">
    <div class="header">
      <div
        class="tab"
        :class="{ 'is-active': activeName === 'shipmentStatus' }"
        @click="handleTabClick('shipmentStatus')"
      >
        Shipment Status
      </div>
      <div
        class="tab"
        :class="{ 'is-active': activeName === 'containerStatus' }"
        @click="handleTabClick('containerStatus')"
      >
        Container Status
      </div>
    </div>
    <div class="content">
      <template v-if="activeName === 'shipmentStatus'">
        <ShipmentStatus :data="props.data?.simplexData" />
      </template>
      <template v-else-if="activeName === 'containerStatus'">
        <ContainerStatus :data="props.data?.containerStatusData" />
      </template>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.transport-step {
  width: 400px;
  height: 484px;
  background-color: #fff;
  border: 1px solid #eaebed;
  border-radius: 12px;
  .header {
    display: flex;
    height: 48px;
    border-radius: 6px 6px 0 0;
    background-color: var(--color-header-bg);
    .tab {
      flex: 1;
      text-align: center;
      line-height: 52px;
      color: var(--color-neutral-3);
      font-size: 18px;
      font-weight: 700;
      cursor: pointer;
      &.is-active {
        border-bottom: 2px solid var(--color-theme);
        color: var(--color-neutral-1);
      }
    }
  }
  .content {
    height: calc(100% - 48px);
  }
}
</style>
