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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. declare var config: Object;
  4. /**
  5. * Notice react component.
  6. *
  7. * @class Notice
  8. */
  9. export default class Notice extends Component<*, *> {
  10. state: Object;
  11. /**
  12. * Constructor of Notice component.
  13. *
  14. * @param {Object} props - The read-only React Component props with which
  15. * the new instance is to be initialized.
  16. */
  17. constructor(props: Object) {
  18. super(props);
  19. const { noticeMessage } = config;
  20. this.state = {
  21. /**
  22. * Message to be shown in notice component.
  23. *
  24. * @type {string}
  25. */
  26. noticeMessage
  27. };
  28. }
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. const { noticeMessage } = this.state;
  37. if (!noticeMessage) {
  38. return null;
  39. }
  40. return (
  41. <div className = 'notice'>
  42. <span className = 'notice__message' >
  43. { noticeMessage }
  44. </span>
  45. </div>
  46. );
  47. }
  48. }