focalboard/webapp/src/components/boardColumn.tsx

48 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-10-20 21:50:53 +02:00
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
2020-10-20 21:52:56 +02:00
import React from 'react'
2020-10-08 18:21:27 +02:00
type Props = {
2020-10-20 21:50:53 +02:00
onDrop?: (e: React.DragEvent<HTMLDivElement>) => void
2020-10-08 18:21:27 +02:00
}
type State = {
2020-10-20 21:50:53 +02:00
isDragOver?: boolean
2020-10-08 18:21:27 +02:00
}
class BoardColumn extends React.Component<Props, State> {
2020-10-20 21:50:53 +02:00
constructor(props: Props) {
super(props)
this.state = {}
}
2020-10-08 18:21:27 +02:00
2020-10-20 21:50:53 +02:00
render() {
const element =
(<div
className={this.state.isDragOver ? 'octo-board-column dragover' : 'octo-board-column'}
onDragOver={(e) => {
2020-10-24 03:29:38 +02:00
e.preventDefault()
this.setState({isDragOver: true})
2020-10-20 21:50:53 +02:00
}}
onDragEnter={(e) => {
2020-10-24 03:29:38 +02:00
e.preventDefault()
this.setState({isDragOver: true})
2020-10-20 21:50:53 +02:00
}}
onDragLeave={(e) => {
2020-10-24 03:29:38 +02:00
e.preventDefault()
this.setState({isDragOver: false})
2020-10-20 21:50:53 +02:00
}}
onDrop={(e) => {
2020-10-24 03:29:38 +02:00
this.setState({isDragOver: false})
this.props.onDrop(e)
2020-10-20 21:50:53 +02:00
}}
>
{this.props.children}
</div>)
2020-10-08 18:21:27 +02:00
2020-10-20 21:50:53 +02:00
return element
}
2020-10-08 18:21:27 +02:00
}
2020-10-20 21:50:53 +02:00
export {BoardColumn}