index.js 682 B

12345678910111213141516171819202122232425
  1. import React from 'react';
  2. import { Link } from 'react-router-dom';
  3. import './index.less';
  4. function Tabs(props) {
  5. const { tabs = [], type = 'line', width, space, border, active } = props;
  6. return (
  7. <div className={`tabs ${type} ${border ? 'border' : ''}`}>
  8. {tabs.map(item => {
  9. return (
  10. <Link to={item.path}>
  11. <div
  12. style={{ width: width || '', marginLeft: space || '', marginRight: space || '' }}
  13. className={`tab ${active === item.key ? 'active' : ''}`}
  14. >
  15. {item.name}
  16. </div>
  17. </Link>
  18. );
  19. })}
  20. </div>
  21. );
  22. }
  23. Tabs.propTypes = {};
  24. export default Tabs;