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.

Notice.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { translate } from '../../../base/i18n';
  5. declare var config: Object;
  6. type Props = {
  7. _message?: string,
  8. };
  9. /**
  10. * Notice react component.
  11. *
  12. * @class Notice
  13. */
  14. class Notice extends Component<Props> {
  15. /**
  16. * Implements React's {@link Component#render()}.
  17. *
  18. * @inheritdoc
  19. * @returns {ReactElement}
  20. */
  21. render() {
  22. if (!this.props._message) {
  23. return null;
  24. }
  25. return (
  26. <div className = 'notice'>
  27. <span className = 'notice__message' >
  28. { this.props._message }
  29. </span>
  30. </div>
  31. );
  32. }
  33. }
  34. /**
  35. * Maps (parts of) the Redux state to the associated
  36. * {@code Notice}'s props.
  37. *
  38. * @param {Object} state - The Redux state.
  39. * @private
  40. * @returns {{
  41. * _message: string,
  42. * }}
  43. */
  44. function _mapStateToProps(state) {
  45. const {
  46. noticeMessage
  47. } = state['features/base/config'];
  48. return {
  49. _message: noticeMessage
  50. };
  51. }
  52. export default translate(connect(_mapStateToProps)(Notice));