index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react';
  2. import { Link } from 'react-router-dom';
  3. import './index.less';
  4. function UserLayout(props) {
  5. const { menu = [], active, right, center } = props;
  6. return (
  7. <div className={`user-layout content ${right ? 'right' : ''}`}>
  8. <div className="left-layout">
  9. <div className="block-layout">
  10. {menu.map(item => {
  11. return (
  12. <Link to={item.path} className={`item ${active === item.key ? 'active' : ''}`}>
  13. {item.title}
  14. </Link>
  15. );
  16. })}
  17. </div>
  18. </div>
  19. {center && (
  20. <div className="center-layout">
  21. {center.length > 0 ? (
  22. center.map(item => {
  23. return <div className="block-layout">{item}</div>;
  24. })
  25. ) : (
  26. <div className="block-layout">{center}</div>
  27. )}
  28. </div>
  29. )}
  30. {right && (
  31. <div className="right-layout">
  32. {right.length > 0 ? (
  33. right.map(item => {
  34. return <div className="block-layout">{item}</div>;
  35. })
  36. ) : (
  37. <div className="block-layout">{right}</div>
  38. )}
  39. </div>
  40. )}
  41. </div>
  42. );
  43. }
  44. export default UserLayout;