Convert ResizeHandle to TypeScript

pull/3095/head
Andrew Watkins 2018-03-29 14:46:31 -07:00
parent 1f2b7b4361
commit b2a6c752eb
2 changed files with 27 additions and 30 deletions

View File

@ -1,30 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
const {func, bool, string} = PropTypes
const ResizeHandle = React.createClass({
propTypes: {
onHandleStartDrag: func.isRequired,
isDragging: bool.isRequired,
theme: string,
top: string,
},
render() {
const {isDragging, onHandleStartDrag, top, theme} = this.props
return (
<div
className={classnames('resizer--handle', {
dragging: isDragging,
'resizer--malachite': theme === 'kapacitor',
})}
onMouseDown={onHandleStartDrag}
style={{top}}
/>
)
},
})
export default ResizeHandle

View File

@ -0,0 +1,27 @@
import React, {SFC} from 'react'
import classnames from 'classnames'
interface Props {
onHandleStartDrag: () => void
isDragging: boolean
theme?: string
top?: string
}
const ResizeHandle: SFC<Props> = ({
onHandleStartDrag,
isDragging,
theme,
top,
}) => (
<div
className={classnames('resizer--handle', {
dragging: isDragging,
'resizer--malachite': theme === 'kapacitor',
})}
onMouseDown={onHandleStartDrag}
style={{top}}
/>
)
export default ResizeHandle