You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
724 B
30 lines
724 B
import React, { Component } from "react"; |
|
import arrayMove from "array-move"; |
|
import "./index.scss"; |
|
|
|
export default class DraggableMessage extends Component { |
|
constructor(props) { |
|
super(props); |
|
this.state = this.props.message; |
|
} |
|
onSortEnd = ({ oldIndex, newIndex }) => { |
|
if (this.props.isActive) |
|
this.setState(({ options }) => ({ |
|
options: arrayMove(options, oldIndex, newIndex), |
|
})); |
|
}; |
|
|
|
render() { |
|
const { isActive } = this.props; |
|
if (!isActive) return null; |
|
return <div className="ptapbox"></div>; |
|
} |
|
a = ( |
|
<button |
|
className="message-2d__submit" |
|
onClick={(e) => this.props.action({ value: e.target.value })} |
|
> |
|
ثبت |
|
</button> |
|
); |
|
}
|
|
|