Migrate ResizeHandle to typescript

This commit is contained in:
Dariusz Niemczyk 2021-08-24 11:15:41 +02:00
parent e2c55c61f3
commit 290ab894aa
No known key found for this signature in database
GPG key ID: 3E8DC619E3C59A05

View file

@ -1,27 +1,26 @@
import React from 'react'; // eslint-disable-line no-unused-vars
import PropTypes from 'prop-types';
//see src/resizer for the actual resizing code, this is just the DOM for the resize handle
const ResizeHandle = (props) => {
interface IResizeHandleProps {
vertical?: boolean;
reverse?: boolean;
id?: string;
}
const ResizeHandle: React.FC<IResizeHandleProps> = ({ vertical, reverse, id }) => {
const classNames = ['mx_ResizeHandle'];
if (props.vertical) {
if (vertical) {
classNames.push('mx_ResizeHandle_vertical');
} else {
classNames.push('mx_ResizeHandle_horizontal');
}
if (props.reverse) {
if (reverse) {
classNames.push('mx_ResizeHandle_reverse');
}
return (
<div className={classNames.join(' ')} data-id={props.id}><div /></div>
<div className={classNames.join(' ')} data-id={id}><div /></div>
);
};
ResizeHandle.propTypes = {
vertical: PropTypes.bool,
reverse: PropTypes.bool,
id: PropTypes.string,
};
export default ResizeHandle;