import React from 'react';
import Common from './tab-common';
import Sort from './tab-sort';
import Expand from './tab-expand';
import PopFilter from './tab-pop-filter';
import connect from "../connect";

/**
 * 属性类型
 */
export interface Props {
  type:
    | 'common' // 普通tab
    | 'expand' // 下拉tab
    | 'sort' // 排序tab
    | 'pop-filter'; // 弹层tab
}

/**
 * Tab
 */
const Tab: React.FC<Props> = ({ type, ...otherProps }) => {
  if (type === 'common') return <Common {...otherProps} />;
  if (type === 'sort') return <Sort {...otherProps} />;
  if (type === 'expand') return <Expand {...otherProps} />;
  if (type === 'pop-filter') return <PopFilter {...otherProps} />;
  return null;
};

export default connect(Tab, {}, {
  'common': (Common as any).default,
  'sort': (Sort as any).default,
  'expand': (Expand as any).default,
  'pop-filter': (PopFilter as any).default,
});
