index.js 556 B

123456789101112131415161718192021
  1. import React from 'react';
  2. import './index.less';
  3. function Navigation(props) {
  4. const { list = [], active = 0, theme, onChange } = props;
  5. return (
  6. <div className={`navigation ${theme}`}>
  7. {list.map((item, index) => {
  8. return (
  9. <div className={`item ${index === active ? 'active' : ''}`} onClick={() => {
  10. if (onChange) onChange(index);
  11. }}>
  12. <span className="text">{item.title}</span>
  13. </div>
  14. );
  15. })}
  16. </div>
  17. );
  18. }
  19. Navigation.propTypes = {};
  20. export default Navigation;