import 'package:flutter/material.dart';

import '../button/button.dart';

class ErrorCard extends StatelessWidget {
  final String title;
  final String message;
  final Function() onTap;
  const ErrorCard({
    super.key,
    required this.title,
    required this.message,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Icon(Icons.error_outline, size: 48, color: Colors.red.shade400),
          const SizedBox(height: 16),
          Text(
            title,
            style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
          ),
          const SizedBox(height: 8),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 32),
            child: Text(
              message,
              textAlign: TextAlign.center,
              style: const TextStyle(color: Colors.grey),
            ),
          ),
          const SizedBox(height: 16),
          AppElevatedButton.filled(
            width: 120,
            onPressed: onTap,
            label: 'Coba Lagi',
          ),
        ],
      ),
    );
  }
}
