您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OverflowMenuItem.web.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. /**
  4. * A React {@code Component} for displaying a link to interact with other
  5. * features of the application.
  6. *
  7. * @extends Component
  8. */
  9. class OverflowMenuItem extends Component {
  10. /**
  11. * {@code OverflowMenuItem} component's property types.
  12. *
  13. * @static
  14. */
  15. static propTypes = {
  16. /**
  17. * The icon class to use for displaying an icon before the link text.
  18. */
  19. icon: PropTypes.string,
  20. /**
  21. * The callback to invoke when {@code OverflowMenuItem} is clicked.
  22. */
  23. onClick: PropTypes.func,
  24. /**
  25. * The text to display in the {@code OverflowMenuItem}.
  26. */
  27. text: PropTypes.string
  28. };
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. return (
  37. <li
  38. className = 'overflow-menu-item'
  39. onClick = { this.props.onClick }>
  40. <span className = 'overflow-menu-item-icon'>
  41. <i className = { this.props.icon } />
  42. </span>
  43. { this.props.text }
  44. </li>
  45. );
  46. }
  47. }
  48. export default OverflowMenuItem;