mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add edit element button
This commit is contained in:
parent
6f2cc5bdc6
commit
c9de9b4ff6
6 changed files with 34 additions and 29 deletions
|
|
@ -35,7 +35,7 @@ function Chapter(props: any) {
|
|||
{(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>
|
||||
<Element orgslug={props.orgslug} courseid={props.courseid} key={element.id} element={element} index={index}></Element>
|
||||
))}
|
||||
{provided.placeholder}
|
||||
</ElementsList>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
import Link from "next/link";
|
||||
import React from "react";
|
||||
import { Draggable } from "react-beautiful-dnd";
|
||||
import styled from "styled-components";
|
||||
|
||||
function Element(props: any) {
|
||||
|
||||
return (
|
||||
<Draggable key={props.element.id} draggableId={props.element.id} index={props.index}>
|
||||
{(provided) => (
|
||||
<ElementWrapper key={props.element.id} {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef}>
|
||||
<p>{props.element.name} </p>
|
||||
<Link href={`/org/${props.orgslug}/course/${props.courseid}/element/${props.element.id.replace("element_", "")}/edit`}>
|
||||
<a target="_blank" rel="noopener noreferrer">Edit</a>
|
||||
</Link>
|
||||
</ElementWrapper>
|
||||
)}
|
||||
</Draggable>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue