import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';

class HeatMapTooltip extends StatelessWidget {
  const HeatMapTooltip({
    required this.date,
    required this.value,
    super.key,
  });

  final DateTime date;
  final int value;

  @override
  Widget build(BuildContext context) {
    return FittedBox(
      fit: BoxFit.scaleDown,
      alignment: AlignmentDirectional.topStart,
      child: Container(
        padding: const EdgeInsets.all(8),
        decoration: BoxDecoration(
          color: ColorsManager.grey700,
          borderRadius: BorderRadius.circular(3),
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.start,
          children: [
            Text(
              DateFormat('MMM d, yyyy').format(date),
              style: context.textTheme.bodySmall?.copyWith(
                fontSize: 12,
                fontWeight: FontWeight.w700,
                color: ColorsManager.whiteColors,
              ),
            ),
            const Divider(height: 2, thickness: 1),
            Text(
              'Occupancy detected: $value',
              style: context.textTheme.bodySmall?.copyWith(
                fontSize: 10,
                fontWeight: FontWeight.w500,
                color: ColorsManager.whiteColors,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
