You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.1 KiB
TypeScript
54 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import classNames from 'classnames';
|
|
|
|
import { Props, SessionIcon } from '../icon';
|
|
|
|
export class SessionIconButton extends React.PureComponent<Props> {
|
|
public static defaultProps = SessionIcon.defaultProps;
|
|
|
|
constructor(props: any) {
|
|
super(props);
|
|
this.clickHandler = this.clickHandler.bind(this);
|
|
}
|
|
|
|
public render() {
|
|
const {
|
|
iconType,
|
|
iconSize,
|
|
iconColor,
|
|
iconRotation,
|
|
iconPadded,
|
|
onClick,
|
|
} = this.props;
|
|
|
|
return (
|
|
<div
|
|
className={classNames(
|
|
'session-icon-button',
|
|
iconSize,
|
|
iconPadded ? 'padded' : ''
|
|
)}
|
|
role="button"
|
|
onClick={e => {
|
|
this.clickHandler(e);
|
|
}}
|
|
>
|
|
<SessionIcon
|
|
iconType={iconType}
|
|
iconSize={iconSize}
|
|
iconColor={iconColor}
|
|
iconRotation={iconRotation}
|
|
onClick={onClick}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
private clickHandler(e: any) {
|
|
if (this.props.onClick) {
|
|
e.stopPropagation();
|
|
this.props.onClick();
|
|
}
|
|
}
|
|
}
|