1 | import React, {Component} from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import classNames from 'classnames';
|
4 |
|
5 | import Button from '../button/button';
|
6 |
|
7 | import styles from './header.css';
|
8 |
|
9 | export default class TrayIcon extends Component {
|
10 | static propTypes = {
|
11 | ...Button.propTypes,
|
12 | icon: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
|
13 | rotatable: PropTypes.bool
|
14 | };
|
15 |
|
16 | static defaultProps = {
|
17 | ...Button.defaultProps,
|
18 | theme: Button.Theme.DARK
|
19 | };
|
20 |
|
21 | render() {
|
22 | const {className, rotatable: rotatable, ...restProps} = this.props;
|
23 | const classes = classNames(styles.icon, className, {
|
24 | [styles.rotatable]: rotatable,
|
25 | [styles.rotated]: rotatable && restProps.active
|
26 | });
|
27 | return (
|
28 | <Button
|
29 | {...restProps}
|
30 | className={classes}
|
31 | />
|
32 | );
|
33 | }
|
34 | }
|