You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RemoteVideoMenuButton.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. /**
  4. * React {@code Component} for displaying an action in {@code RemoteVideoMenu}.
  5. *
  6. * @extends {Component}
  7. */
  8. export default class RemoteVideoMenuButton extends Component {
  9. /**
  10. * {@code RemoteVideoMenuButton}'s property types.
  11. *
  12. * @static
  13. */
  14. static propTypes = {
  15. /**
  16. * Text to display within the component that describes the onClick
  17. * action.
  18. */
  19. buttonText: PropTypes.string,
  20. /**
  21. * Additional CSS classes to add to the component.
  22. */
  23. displayClass: PropTypes.string,
  24. /**
  25. * The CSS classes for the icon that will display within the component.
  26. */
  27. iconClass: PropTypes.string,
  28. /**
  29. * The id attribute to be added to the component's DOM for retrieval
  30. * when querying the DOM. Not used directly by the component.
  31. */
  32. id: PropTypes.string,
  33. /**
  34. * Callback to invoke when the component is clicked.
  35. */
  36. onClick: PropTypes.func
  37. };
  38. /**
  39. * Implements React's {@link Component#render()}.
  40. *
  41. * @inheritdoc
  42. * @returns {ReactElement}
  43. */
  44. render() {
  45. const {
  46. buttonText,
  47. displayClass,
  48. iconClass,
  49. id,
  50. onClick
  51. } = this.props;
  52. const linkClassName = `popupmenu__link ${displayClass || ''}`;
  53. return (
  54. <li className = 'popupmenu__item'>
  55. <a
  56. className = { linkClassName }
  57. id = { id }
  58. onClick = { onClick }>
  59. <span className = 'popupmenu__icon'>
  60. <i className = { iconClass } />
  61. </span>
  62. <span className = 'popupmenu__text'>
  63. { buttonText }
  64. </span>
  65. </a>
  66. </li>
  67. );
  68. }
  69. }