2
0

MsgSystem.tsx 927 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { useState } from "react";
  2. interface IWidget {
  3. value?: string;
  4. }
  5. const MsgSystem = ({ value }: IWidget) => {
  6. const [display, setDisplay] = useState(false);
  7. return (
  8. <div
  9. style={{
  10. backgroundColor: "#fafafa",
  11. border: "1px dashed #d9d9d9",
  12. borderRadius: 4,
  13. marginTop: 8,
  14. fontSize: 12,
  15. color: "#888",
  16. padding: 8,
  17. }}
  18. >
  19. <div
  20. style={{ cursor: "pointer", userSelect: "none" }}
  21. onClick={() => {
  22. setDisplay(!display);
  23. }}
  24. >
  25. {display ? "▼ 收起资料" : "▶ 展开资料"}
  26. </div>
  27. <div style={{ display: display ? "block" : "none" }}>
  28. <pre
  29. style={{
  30. whiteSpace: "pre-wrap",
  31. wordBreak: "break-word",
  32. marginTop: 4,
  33. }}
  34. >
  35. {value}
  36. </pre>
  37. </div>
  38. </div>
  39. );
  40. };
  41. export default MsgSystem;