Menu.js 513 B

123456789101112131415161718192021222324252627282930
  1. import React from 'react';
  2. class Menu extends React.Component {
  3. static create = function (type) {
  4. return class TypedMenu extends Menu {
  5. constructor(props) {
  6. super(props, type);
  7. }
  8. };
  9. }
  10. constructor(props, type) {
  11. super(props);
  12. this.type = type;
  13. }
  14. render() {
  15. const { children } = this.props;
  16. const { type } = this;
  17. return (
  18. <div className="menu" data-status={`${type}-selected`}>
  19. {children}
  20. </div>
  21. );
  22. }
  23. }
  24. export default Menu;