mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: modal effects
This commit is contained in:
parent
c70f7361ce
commit
938cfcb4b3
4 changed files with 51 additions and 19 deletions
|
|
@ -3,7 +3,7 @@ import styled from "styled-components";
|
|||
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
||||
import Element, { ElementWrapper } from "./element";
|
||||
import Link from "next/link";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
const ChapterWrapper = styled.div`
|
||||
margin-bottom: 5px;
|
||||
|
|
@ -21,19 +21,36 @@ function Chapter(props: any) {
|
|||
return (
|
||||
<Draggable key={props.info.list.chapter.id} draggableId={props.info.list.chapter.id} index={props.index}>
|
||||
{(provided, snapshot) => (
|
||||
<ChapterWrapper {...provided.dragHandleProps} {...provided.draggableProps} ref={provided.innerRef} isDragging={snapshot.isDragging} key={props.info.list.chapter.id}>
|
||||
<h3>{props.info.list.chapter.name} <button onClick={() => {props.deleteChapter(props.info.list.chapter.id)}}>X</button></h3>
|
||||
<Droppable key={props.info.list.chapter.id} droppableId={props.info.list.chapter.id} type="element">
|
||||
{(provided) => (
|
||||
<ElementsList {...provided.droppableProps} ref={provided.innerRef}>
|
||||
{props.info.list.elements.map((element: any, index: any) => (
|
||||
<Element key={element.id} element={element} index={index}></Element>
|
||||
))}
|
||||
{provided.placeholder}
|
||||
</ElementsList>
|
||||
)}
|
||||
</Droppable>
|
||||
</ChapterWrapper>
|
||||
|
||||
<ChapterWrapper
|
||||
{...provided.dragHandleProps}
|
||||
{...provided.draggableProps}
|
||||
ref={provided.innerRef}
|
||||
isDragging={snapshot.isDragging}
|
||||
key={props.info.list.chapter.id}
|
||||
>
|
||||
<h3>
|
||||
{props.info.list.chapter.name}{" "}
|
||||
<button
|
||||
onClick={() => {
|
||||
props.deleteChapter(props.info.list.chapter.id);
|
||||
}}
|
||||
>
|
||||
X
|
||||
</button>
|
||||
</h3>
|
||||
<Droppable key={props.info.list.chapter.id} droppableId={props.info.list.chapter.id} type="element">
|
||||
{(provided) => (
|
||||
<ElementsList {...provided.droppableProps} ref={provided.innerRef}>
|
||||
{props.info.list.elements.map((element: any, index: any) => (
|
||||
<Element key={element.id} element={element} index={index}></Element>
|
||||
))}
|
||||
{provided.placeholder}
|
||||
</ElementsList>
|
||||
)}
|
||||
</Droppable>
|
||||
</ChapterWrapper>
|
||||
|
||||
)}
|
||||
</Draggable>
|
||||
);
|
||||
|
|
@ -43,6 +60,4 @@ const ElementsList = styled.div`
|
|||
padding: 10px;
|
||||
`;
|
||||
|
||||
|
||||
|
||||
export default Chapter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue