Migrate ResizeHandle to typescript
This commit is contained in:
parent
e2c55c61f3
commit
290ab894aa
1 changed files with 10 additions and 11 deletions
|
@ -1,27 +1,26 @@
|
||||||
|
|
||||||
import React from 'react'; // eslint-disable-line no-unused-vars
|
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
|
//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'];
|
const classNames = ['mx_ResizeHandle'];
|
||||||
if (props.vertical) {
|
if (vertical) {
|
||||||
classNames.push('mx_ResizeHandle_vertical');
|
classNames.push('mx_ResizeHandle_vertical');
|
||||||
} else {
|
} else {
|
||||||
classNames.push('mx_ResizeHandle_horizontal');
|
classNames.push('mx_ResizeHandle_horizontal');
|
||||||
}
|
}
|
||||||
if (props.reverse) {
|
if (reverse) {
|
||||||
classNames.push('mx_ResizeHandle_reverse');
|
classNames.push('mx_ResizeHandle_reverse');
|
||||||
}
|
}
|
||||||
return (
|
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;
|
export default ResizeHandle;
|
Loading…
Add table
Add a link
Reference in a new issue