mirror of
https://github.com/sigmasternchen/threadule
synced 2025-03-15 08:09:01 +00:00
feat: reordering tweets now works in frontend
This commit is contained in:
parent
974d1c4c2d
commit
1eedd5e609
1 changed files with 11 additions and 2 deletions
|
@ -80,10 +80,19 @@ const Index: FunctionComponent<ThreadFormProps> = (
|
|||
}}
|
||||
/>
|
||||
</Grid>
|
||||
<DragDropContext onDragEnd={() => {
|
||||
<DragDropContext onDragEnd={(result) => {
|
||||
if (!result.destination) {
|
||||
return
|
||||
}
|
||||
|
||||
const tweet = thread.tweets.splice(result.source.index, 1)
|
||||
thread.tweets.splice(result.destination!.index, 0, ...tweet)
|
||||
setThread({
|
||||
...thread
|
||||
})
|
||||
}}>
|
||||
<Droppable droppableId={"1"}>
|
||||
{(provided, snapshot) => (
|
||||
{(provided) => (
|
||||
<Grid
|
||||
container
|
||||
item
|
||||
|
|
Loading…
Reference in a new issue