HistoryPanel.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { Button } from "antd";
  2. import React, { useState, forwardRef, useImperativeHandle } from "react";
  3. import { useModel } from "umi";
  4. export default forwardRef(function HistoryPanel(props, ref) {
  5. const {
  6. showHistory,
  7. setShowHistory
  8. } = useModel("appModel");
  9. const ItemComponent = () => {
  10. const [showBtn, setShowBtn] = useState(false);
  11. return (
  12. <div
  13. className="flex items-center p-12px hover:bg-#f9f9f9"
  14. onMouseOver={() => setShowBtn(true)}
  15. onMouseOut={() => setShowBtn(false)}
  16. >
  17. <div className="flex-1">
  18. <div className="text-sm text-#333">标题xxxxxxxxxxxxxx</div>
  19. <div className="text-xs text-#999">2024-12-12 20:08:30</div>
  20. </div>
  21. {showBtn && (
  22. <div>
  23. <Button
  24. type="text"
  25. size="small"
  26. icon={<i className="iconfont icon-lishijilu" />}
  27. />
  28. <Button
  29. type="text"
  30. size="small"
  31. icon={<i className="iconfont icon-shanchu" />}
  32. />
  33. </div>
  34. )}
  35. </div>
  36. );
  37. };
  38. return (
  39. <div
  40. className="absolute left-0 top-0 w-full h-full bg-white flex flex-col"
  41. style={{ display: showHistory ? "flex" : "none" }}
  42. >
  43. <div className="flex py-8px px-12px items-center border-b-1px border-b-solid border-b-#eee">
  44. <div className="flex-1">历史记录</div>
  45. <div
  46. className="w-16px h-16px cursor-pointer"
  47. onClick={() => setShowHistory(false)}
  48. >
  49. <i className="iconfont icon-cuowu-1 color-#666 hover:color-#333" />
  50. </div>
  51. </div>
  52. <div className="flex-1 overflow-y-auto">
  53. {new Array(100).fill(0).map((_, i) => (
  54. <ItemComponent key={i} />
  55. ))}
  56. </div>
  57. </div>
  58. );
  59. });