mock平台

Footer.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import './Footer.scss';
  2. import React, { PureComponent as Component } from 'react';
  3. import PropTypes from 'prop-types';
  4. import { Row, Col } from 'antd';
  5. import { Icon } from 'antd';
  6. const version = process.env.version;
  7. class Footer extends Component {
  8. constructor(props) {
  9. super(props);
  10. }
  11. static propTypes = {
  12. footList: PropTypes.array
  13. };
  14. render() {
  15. return (
  16. <div className="footer-wrapper">
  17. <Row className="footer-container">
  18. {this.props.footList.map(function(item, i) {
  19. return (
  20. <FootItem
  21. key={i}
  22. linkList={item.linkList}
  23. title={item.title}
  24. iconType={item.iconType}
  25. />
  26. );
  27. })}
  28. </Row>
  29. </div>
  30. );
  31. }
  32. }
  33. class FootItem extends Component {
  34. constructor(props) {
  35. super(props);
  36. }
  37. static propTypes = {
  38. linkList: PropTypes.array,
  39. title: PropTypes.string,
  40. iconType: PropTypes.string
  41. };
  42. render() {
  43. return (
  44. <Col span={6}>
  45. <h4 className="title">
  46. {this.props.iconType ? <Icon type={this.props.iconType} className="icon" /> : ''}
  47. {this.props.title}
  48. </h4>
  49. {this.props.linkList.map(function(item, i) {
  50. return (
  51. <p key={i}>
  52. <a href={item.itemLink} className="link">
  53. {item.itemTitle}
  54. </a>
  55. </p>
  56. );
  57. })}
  58. </Col>
  59. );
  60. }
  61. }
  62. Footer.defaultProps = {
  63. footList: [
  64. {
  65. title: 'GitHub',
  66. iconType: 'github',
  67. linkList: [
  68. {
  69. itemTitle: 'YApi 源码仓库',
  70. itemLink: 'https://github.com/YMFE/yapi'
  71. }
  72. ]
  73. },
  74. {
  75. title: '团队',
  76. iconType: 'team',
  77. linkList: [
  78. {
  79. itemTitle: 'YMFE',
  80. itemLink: 'https://ymfe.org'
  81. }
  82. ]
  83. },
  84. {
  85. title: '反馈',
  86. iconType: 'aliwangwang-o',
  87. linkList: [
  88. {
  89. itemTitle: 'Github Issues',
  90. itemLink: 'https://github.com/YMFE/yapi/issues'
  91. },
  92. {
  93. itemTitle: 'Github Pull Requests',
  94. itemLink: 'https://github.com/YMFE/yapi/pulls'
  95. }
  96. ]
  97. },
  98. {
  99. title: 'Copyright © 2018 YMFE',
  100. linkList: [
  101. {
  102. itemTitle: `版本: ${version} `,
  103. itemLink: 'https://github.com/YMFE/yapi/blob/master/CHANGELOG.md'
  104. },
  105. {
  106. itemTitle: '使用文档',
  107. itemLink: 'https://hellosean1025.github.io/yapi/'
  108. }
  109. ]
  110. }
  111. ]
  112. };
  113. export default Footer;