/**
 * ElementSettingsTabs
 *
 * Tab navigation for element settings.
 * Provides General Settings and CSS Styles tabs.
 */

import React from 'react';
import type { ElementSettingsTabsProps } from './types';

const ElementSettingsTabs: React.FC<ElementSettingsTabsProps> = ({
  activeTab,
  onTabChange,
  tabs,
}) => {
  return (
    <div className='mb-4 inline-flex overflow-hidden rounded border border-gray-300 dark:border-dark-700'>
      {tabs.map((tab) => (
        <button
          key={tab.id}
          type='button'
          className={`px-4 py-2 text-sm font-medium transition-colors ${
            activeTab === tab.id
              ? 'bg-blue-600 text-white'
              : 'bg-white text-gray-700 hover:bg-gray-50 dark:bg-dark-800 dark:text-gray-200 dark:hover:bg-dark-700'
          }`}
          onClick={() => onTabChange(tab.id)}
        >
          {tab.label}
        </button>
      ))}
    </div>
  );
};

/**
 * Compact version for constructor sidebar
 */
export const ElementSettingsTabsCompact: React.FC<ElementSettingsTabsProps> = ({
  activeTab,
  onTabChange,
  tabs,
}) => {
  return (
    <div className='mb-2 inline-flex w-full overflow-hidden rounded border border-white/30'>
      {tabs.map((tab) => (
        <button
          key={tab.id}
          type='button'
          className={`flex-1 px-1.5 py-1 text-[10px] font-semibold transition-colors ${
            activeTab === tab.id
              ? 'bg-blue-600 text-white'
              : 'bg-white/20 text-white/80 hover:bg-white/30'
          }`}
          onClick={() => onTabChange(tab.id)}
        >
          {tab.label}
        </button>
      ))}
    </div>
  );
};

export default ElementSettingsTabs;
