index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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, ads = [] } = 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.short}
  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. {ads.length > 0 && ads.map(item => {
  40. return <div className="block-layout">{item}</div>;
  41. })}
  42. </div>
  43. )}
  44. </div>
  45. );
  46. }
  47. export default UserLayout;