1 | import React, {Children, Component} from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import classNames from 'classnames';
|
4 |
|
5 | import styles from './header.css';
|
6 |
|
7 | const wrapChild = child => child && (
|
8 | <div className={styles.trayItem}>{child}</div>
|
9 | );
|
10 |
|
11 | export default class Tray extends Component {
|
12 | static propTypes = {
|
13 | className: PropTypes.string,
|
14 | children: PropTypes.node
|
15 | };
|
16 |
|
17 | render() {
|
18 | const {children, className, ...restProps} = this.props;
|
19 | const classes = classNames(styles.tray, className);
|
20 |
|
21 | return (
|
22 | <div
|
23 | {...restProps}
|
24 | className={classes}
|
25 | >
|
26 | {Children.map(children, wrapChild)}
|
27 | </div>
|
28 | );
|
29 | }
|
30 | }
|