UNPKG

671 BJavaScriptView Raw
1import React, {Children, Component} from 'react';
2import PropTypes from 'prop-types';
3import classNames from 'classnames';
4
5import styles from './header.css';
6
7const wrapChild = child => child && (
8 <div className={styles.trayItem}>{child}</div>
9);
10
11export 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}