2019-12-05 06:02:32 +01:00
|
|
|
import React from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2019-12-06 07:07:31 +01:00
|
|
|
import { Props, SessionIcon } from './SessionIcon';
|
2019-12-05 06:02:32 +01:00
|
|
|
|
2019-12-06 07:07:31 +01:00
|
|
|
export class SessionIconButton extends React.PureComponent<Props> {
|
2019-12-09 03:57:18 +01:00
|
|
|
public static defaultProps = SessionIcon.defaultProps;
|
|
|
|
|
2019-12-05 06:12:33 +01:00
|
|
|
constructor(props: any) {
|
|
|
|
super(props);
|
|
|
|
this.clickHandler = this.clickHandler.bind(this);
|
|
|
|
}
|
2019-12-05 06:02:32 +01:00
|
|
|
|
2019-12-05 06:12:33 +01:00
|
|
|
public render() {
|
|
|
|
return (
|
|
|
|
<div
|
2019-12-09 03:48:04 +01:00
|
|
|
className={classNames(
|
|
|
|
'session-icon-button',
|
|
|
|
this.props.iconSize,
|
|
|
|
this.props.iconPadded ? 'padded' : ''
|
|
|
|
)}
|
2019-12-05 06:12:33 +01:00
|
|
|
role="button"
|
2019-12-05 07:18:51 +01:00
|
|
|
onClick={e => {
|
|
|
|
this.clickHandler(e);
|
|
|
|
}}
|
2019-12-05 06:12:33 +01:00
|
|
|
>
|
2019-12-06 06:30:26 +01:00
|
|
|
<SessionIcon
|
|
|
|
iconType={this.props.iconType}
|
|
|
|
iconSize={this.props.iconSize}
|
|
|
|
iconColor={this.props.iconSize}
|
|
|
|
iconRotation={this.props.iconRotation}
|
|
|
|
onClick={this.props.onClick}
|
|
|
|
/>
|
2019-12-05 06:12:33 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2019-12-05 06:02:32 +01:00
|
|
|
|
2019-12-05 07:18:20 +01:00
|
|
|
private clickHandler(e: any) {
|
|
|
|
if (this.props.onClick) {
|
|
|
|
e.stopPropagation();
|
|
|
|
this.props.onClick();
|
|
|
|
}
|
2019-12-05 06:12:33 +01:00
|
|
|
}
|
|
|
|
}
|