session-desktop/ts/components/session/SessionIconButton.tsx

45 lines
1 KiB
TypeScript
Raw Normal View History

import React from 'react';
import classNames from 'classnames';
import { Props, SessionIcon } from './SessionIcon';
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: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"
onClick={e => {
this.clickHandler(e);
}}
2019-12-05 06:12:33 +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>
);
}
private clickHandler(e: any) {
if (this.props.onClick) {
e.stopPropagation();
this.props.onClick();
}
2019-12-05 06:12:33 +01:00
}
}