<template>
  <div class="calendar-widget" :class="sizeClass" @click="openDialog = true">
    <div class="month">January 2026</div>
    <div class="day">22</div>
    <div class="details">
      <span>Week 4 - Thu</span>
      <span>Lunar: Month 1 Day 4</span>
    </div>
  </div>
  <CalendarDialog v-model:open="openDialog" />
</template>

<script setup lang="ts">
import { computed, ref } from 'vue';
import CalendarDialog from './dialog.vue';

type WidgetSize = '1x1' | '1x2' | '2x1' | '2x2' | '2x4';

const props = defineProps<{
  size: WidgetSize;
  data?: any;
}>();

const openDialog = ref(false);
const sizeClass = computed(() => `size-${props.size}`);
</script>

<style lang="scss" scoped>
@import '@/styles/tokens.scss';

.calendar-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: white;

  .month {
    font-size: 14px;
    font-weight: 600;
    color: #ff6b6b;
    margin-bottom: 2px;
  }

  .day {
    font-size: 48px;
    font-weight: 600;
    line-height: 1;
  }

  .details {
    font-size: 12px;
    color: $color-text-secondary;
    display: flex;
    flex-direction: column;
    margin-top: 4px;
  }

  &.size-1x1 {
    .month {
      font-size: 12px;
    }

    .day {
      font-size: 34px;
    }

    .details {
      display: none;
    }
  }

  &.size-1x2,
  &.size-2x1 {
    .day {
      font-size: 44px;
    }
  }

  &.size-2x2,
  &.size-2x4 {
    .day {
      font-size: 56px;
    }

    .details {
      font-size: 13px;
    }
  }
}
</style>
