interface QuillCharCounterProps {
    currentCount: number;
    maxLength?: number;
    minLength?: number;
}

const QuillCharCounter: React.FC<QuillCharCounterProps> = ({
    currentCount,
    maxLength,
    minLength = 0
}) => {
    const getStatusColor = () => {
        if (currentCount > (maxLength || Infinity)) return 'text-red-500';
        if (currentCount < minLength) return 'text-amber-500';
        return 'text-gray-500';
    };

    return (
        <div className={`
        flex items-center justify-end gap-1
        px-3 py-1.5 text-sm
        ${getStatusColor()}
        transition-colors duration-200
      `}>
            <span className="font-medium tabular-nums">{currentCount}</span>
            {maxLength && (
                <>
                    <span>/</span>
                    <span className="tabular-nums">{maxLength}</span>
                </>
            )}
            <span>字符</span>
            {minLength > 0 && currentCount < minLength && (
                <span className="ml-2 text-amber-500">
                    至少输入 {minLength} 字符
                </span>
            )}
        </div>
    );
};

export default QuillCharCounter