From 421ef0a9eabb9cf95edb02ef7285f40991c55d87 Mon Sep 17 00:00:00 2001 From: mahdi Date: Tue, 31 May 2022 10:18:20 +0430 Subject: [PATCH] update src/components/Accordion/AccordionDesign1/index.js and src/components/Code/index.js --- .../Accordion/AccordionDesign1/index.js | 261 ++++++++++-------- src/components/Code/index.js | 2 + 2 files changed, 142 insertions(+), 121 deletions(-) diff --git a/src/components/Accordion/AccordionDesign1/index.js b/src/components/Accordion/AccordionDesign1/index.js index 9fdd181..b10a830 100644 --- a/src/components/Accordion/AccordionDesign1/index.js +++ b/src/components/Accordion/AccordionDesign1/index.js @@ -18,135 +18,137 @@ const AccordionDesign1 = ({ courses, vod }) => { } return ( - - - {(provided) => ( -
- {courses.map((course, index) => ( - - {(provided) => ( -
- {/* parent */} + <> + + + {(provided) => ( +
+ {courses.map((course, index) => ( + + {(provided) => (
- setActiveAccordion( - activeAccordion === course ? null : course - ) - } + className="flex flex-col" + key={index} + props={{ + ref: provided.innerRef, + ...provided.draggableProps, + ...provided.dragHandleProps, + }} + style={provided.draggableProps.style} > - -

{course.title}

- {vod && ( -
-

- دقیقه: - {course.min} -

-
-

- ویدیو: - {course.video} -

-
- )} - + setActiveAccordion( + activeAccordion === course ? null : course + ) } - alt="" - class="w-3 ml-2" - /> -
- {/* child */} - {activeAccordion === course && - course.lessons.map((lesson, i) => ( -
-
- {vod === !true && ( - line - )} - - {i + 1} - + > + +

{course.title}

+ {vod && ( +
+

+ دقیقه: + {course.min} +

+
+

+ ویدیو: + {course.video} +

-
-

{lesson.name}

-
- {vod ? ( - <> -
-

- دقیقه: - {course.min} -

-
- - ) : ( - <> + )} + +
+ {/* child */} + {activeAccordion === course && + course.lessons.map((lesson, i) => ( +
+
+ {vod === !true && ( delete-button - edit-button - - )} + )} + + {i + 1} + +
+
+

{lesson.name}

+
+ {vod ? ( + <> +
+

+ دقیقه: + {course.min} +

+
+ + ) : ( + <> + delete-button + edit-button + + )} +
-
- ))} - {provided.placeholder} -
- )} -
- ))} -
- )} -
-
+ ))} + {provided.placeholder} +
+ )} +
+ ))} +
+ )} +
+
+ ); }; @@ -209,3 +211,20 @@ AccordionDesign1.defaultProps = { }, ], }; + +{ + /* monaco */ +} + +// import MonacoEditor from "react-monaco-editor";‍ + +// diff --git a/src/components/Code/index.js b/src/components/Code/index.js index c700b32..5d8394b 100644 --- a/src/components/Code/index.js +++ b/src/components/Code/index.js @@ -1,5 +1,6 @@ import { useState } from "react"; import copyIcon from "./copy.png"; +import MonacoEditor from "react-monaco-editor"; function Code({ code }) { const [copied, setCopied] = useState(false); @@ -13,6 +14,7 @@ function Code({ code }) { /* Copy the text inside the text field */ navigator.clipboard.writeText(copyText); }; + return (