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

class AnalyticsErrorWidget extends StatelessWidget {
  const AnalyticsErrorWidget(this.errorMessage, {super.key});

  final String? errorMessage;

  @override
  Widget build(BuildContext context) {
    return Visibility(
      visible: errorMessage != null || (errorMessage?.isNotEmpty ?? false),
      child: Padding(
        padding: const EdgeInsetsDirectional.only(bottom: 10),
        child: Text(
          errorMessage ?? 'Something went wrong',
          maxLines: 1,
          overflow: TextOverflow.ellipsis,
          style: context.textTheme.bodySmall?.copyWith(
            color: ColorsManager.red,
            fontWeight: FontWeight.w400,
            fontSize: 8,
          ),
        ),
      ),
    );
  }
}
