'use client';

import React from 'react';

const FilterTabs = ({ tabs = [], value, onChange, className = ''}) => {
  return (
    <div className={`inline-flex self-start border border-neutral-200 dark:border-[#1B1B1B] rounded-xl overflow-hidden ${className}`}>
      {tabs.map((tab, index) => (
        <button
          key={tab.key}
          onClick={() => onChange(tab.key)}
          className={[
            'px-3 py-1.5 text-xs font-medium transition-colors cursor-pointer',
            index !== 0 ? 'border-l border-neutral-200 dark:border-[#1B1B1B]' : '',
            value === tab.key
              ? 'bg-neutral-100 dark:bg-neutral-700/40 text-neutral-900 dark:text-white'
              : 'bg-white dark:bg-[#0B0B0B] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-900',
          ].filter(Boolean).join(' ')}
        >
          {tab.label}
          {tab.count !== undefined && (
            <span className={`ml-1.5 text-[10px] ${
              value === tab.key ? 'text-neutral-500 dark:text-neutral-400' : 'text-neutral-400'
            }`}>
              {tab.count}
            </span>
          )}
        </button>
      ))}
    </div>
  );
};

export default FilterTabs;
