import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';

import '../../../../../../common/theme/theme.dart';
import '../../../../../../sample/sample_data.dart';
import '../../../../../router/app_router.gr.dart';
import 'popular_merchant_card.dart';

class HomePopularMerchantSection extends StatelessWidget {
  const HomePopularMerchantSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
      child: Column(
        children: [
          Row(
            children: [
              Text(
                'Popular Merchants',
                style: AppStyle.xl.copyWith(fontWeight: FontWeight.bold),
              ),
              Spacer(),
              InkWell(
                onTap: () => context.router.push(MerchantRoute()),
                child: Row(
                  children: [
                    Text(
                      'Lihat Semua',
                      style: AppStyle.sm.copyWith(
                        fontWeight: FontWeight.w500,
                        color: AppColor.primary,
                      ),
                    ),
                    SizedBox(width: 4),
                    Icon(
                      Icons.arrow_forward_ios,
                      size: 12,
                      color: AppColor.primary,
                    ),
                  ],
                ),
              ),
            ],
          ),
          SizedBox(height: 16),
          ...List.generate(
            merchants.length,
            (index) => HomePopularMerchantCard(merchant: merchants[index]),
          ),
        ],
      ),
    );
  }
}
