2019-02-13 11:44:58 +00:00
|
|
|
/** @format */
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import { Component } from '@wordpress/element';
|
|
|
|
import { compose } from '@wordpress/compose';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import './style.scss';
|
2019-07-10 16:58:51 +00:00
|
|
|
import TransientNotice from './transient-notice';
|
2019-02-13 11:44:58 +00:00
|
|
|
import withSelect from 'wc-api/with-select';
|
|
|
|
|
|
|
|
class TransientNotices extends Component {
|
|
|
|
render() {
|
2019-07-10 16:58:51 +00:00
|
|
|
const { className, notices } = this.props;
|
|
|
|
const classes = classnames( 'woocommerce-transient-notices', className );
|
2019-07-08 04:10:34 +00:00
|
|
|
|
2019-07-10 16:58:51 +00:00
|
|
|
return (
|
|
|
|
<section className={ classes }>
|
|
|
|
{ notices && notices.map( ( notice, i ) => <TransientNotice key={ i } { ...notice } /> ) }
|
|
|
|
</section>
|
|
|
|
);
|
2019-02-13 11:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TransientNotices.propTypes = {
|
|
|
|
/**
|
|
|
|
* Additional class name to style the component.
|
|
|
|
*/
|
|
|
|
className: PropTypes.string,
|
|
|
|
/**
|
|
|
|
* Array of notices to be displayed.
|
|
|
|
*/
|
|
|
|
notices: PropTypes.array,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withSelect( select => {
|
2019-07-10 16:58:51 +00:00
|
|
|
const { getNotices } = select( 'wc-admin' );
|
|
|
|
const notices = getNotices();
|
2019-02-13 11:44:58 +00:00
|
|
|
|
|
|
|
return { notices };
|
2019-07-10 16:58:51 +00:00
|
|
|
} )
|
2019-02-13 11:44:58 +00:00
|
|
|
)( TransientNotices );
|