基于umi的开发模板

index.tsx 823B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React, { ReactHTMLElement } from "react";
  2. import PropTypes from "prop-types";
  3. import closeBtnPng from "./icon_quit.png";
  4. import closeBtn2xPng from "./icon_quit@2x.png";
  5. const ModalCloseBtn = (props: any): JSX.Element => (
  6. <div
  7. role="button"
  8. tabIndex={0}
  9. onKeyPress={() => {}}
  10. onClick={() => props.onClick()}
  11. style={{
  12. position: "absolute",
  13. cursor: "pointer",
  14. top: "9px",
  15. right: "9px",
  16. width: "18px",
  17. height: "18px",
  18. outline: "none"
  19. }}
  20. >
  21. <img
  22. style={{ width: "100%", height: "100%" }}
  23. src={closeBtnPng}
  24. srcSet={`${closeBtnPng} 1400w, ${closeBtn2xPng} 2800w`}
  25. alt="close_modal"
  26. />
  27. </div>
  28. );
  29. ModalCloseBtn.propTypes = {
  30. onClick: PropTypes.oneOfType([PropTypes.any]).isRequired
  31. };
  32. export default ModalCloseBtn;