12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /* @flow */
-
- import React, { Component } from 'react';
- import { connect } from 'react-redux';
-
- import { translate } from '../../../base/i18n';
-
- declare var config: Object;
-
- type Props = {
- _message?: string,
- };
-
- /**
- * Notice react component.
- *
- * @class Notice
- */
- class Notice extends Component<Props> {
-
- /**
- * Implements React's {@link Component#render()}.
- *
- * @inheritdoc
- * @returns {ReactElement}
- */
- render() {
- if (!this.props._message) {
- return null;
- }
-
- return (
- <div className = 'notice'>
- <span className = 'notice__message' >
- { this.props._message }
- </span>
- </div>
- );
- }
- }
-
- /**
- * Maps (parts of) the Redux state to the associated
- * {@code Notice}'s props.
- *
- * @param {Object} state - The Redux state.
- * @private
- * @returns {{
- * _message: string,
- * }}
- */
- function _mapStateToProps(state) {
- const {
- noticeMessage
- } = state['features/base/config'];
-
- return {
- _message: noticeMessage
- };
- }
- export default translate(connect(_mapStateToProps)(Notice));
|