mock平台

View.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { Button } from 'antd';
  4. import { Link } from 'react-router-dom';
  5. const WikiView = props => {
  6. const { editorEable, onEditor, uid, username, editorTime, desc } = props;
  7. return (
  8. <div className="wiki-view-content">
  9. <div className="wiki-title">
  10. <Button icon="edit" onClick={onEditor} disabled={!editorEable}>
  11. 编辑
  12. </Button>
  13. {username && (
  14. <div className="wiki-user">
  15. 由{' '}
  16. <Link className="user-name" to={`/user/profile/${uid || 11}`}>
  17. {username}
  18. </Link>{' '}
  19. 修改于 {editorTime}
  20. </div>
  21. )}
  22. </div>
  23. <div
  24. className="tui-editor-contents"
  25. dangerouslySetInnerHTML={{ __html: desc }}
  26. />
  27. </div>
  28. );
  29. };
  30. WikiView.propTypes = {
  31. editorEable: PropTypes.bool,
  32. onEditor: PropTypes.func,
  33. uid: PropTypes.number,
  34. username: PropTypes.string,
  35. editorTime: PropTypes.string,
  36. desc: PropTypes.string
  37. };
  38. export default WikiView;