build(deps): update package.json, src/components/Accordion/AccordionDesign1/index.js, src/components/CardDesgin/CardDesign2/index.js and yarn.lock

master
mahdi 3 years ago
parent 0fd90401a1
commit d693992591
  1. 1
      package.json
  2. 47
      src/components/Accordion/AccordionDesign1/index.js
  3. 16842
      yarn.lock

@ -36,6 +36,7 @@
"react-input-range": "^1.3.0", "react-input-range": "^1.3.0",
"react-leaflet": "^3.2.5", "react-leaflet": "^3.2.5",
"react-leaflet-draw": "^0.19.8", "react-leaflet-draw": "^0.19.8",
"react-monaco-editor": "^0.48.0",
"react-multi-date-picker": "^3.3.0", "react-multi-date-picker": "^3.3.0",
"react-qr-code": "^2.0.7", "react-qr-code": "^2.0.7",
"react-redux": "^7.2.6", "react-redux": "^7.2.6",

@ -3,9 +3,9 @@ import CircleInCircle from "../../MiniComponents/CircleInCircle";
import Button from "../../ButtonDesign/Button"; import Button from "../../ButtonDesign/Button";
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd"; import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
const AccordionDesign1 = ({ items, vod }) => { const AccordionDesign1 = ({ courses, vod }) => {
const [activeAccordion, setActiveAccordion] = useState(null); const [activeAccordion, setActiveAccordion] = useState(null);
const [accordions, updateAccordion] = useState(items); const [accordions, updateAccordion] = useState(courses);
function handleOnDragEnd(result) { function handleOnDragEnd(result) {
if (!result.destination) return; if (!result.destination) return;
@ -19,18 +19,18 @@ const AccordionDesign1 = ({ items, vod }) => {
return ( return (
<DragDropContext onDragEnd={handleOnDragEnd}> <DragDropContext onDragEnd={handleOnDragEnd}>
<Droppable droppableId="container"> <Droppable droppableId="accordions">
{(provided) => ( {(provided) => (
<section <section
className="w-full flex flex-col bg-gray-200" className="w-full flex flex-col bg-gray-200"
{...provided.droppableProps} {...provided.droppableProps}
ref={provided.innerRef} ref={provided.innerRef}
id="container" id="accordions"
> >
{items.map((item, index) => ( {courses.map((course, index) => (
<Draggable <Draggable
key={item.id} key={course.id}
draggableId={"e" + item.id} draggableId={"e" + course.id}
index={index} index={index}
> >
{(provided) => ( {(provided) => (
@ -47,13 +47,13 @@ const AccordionDesign1 = ({ items, vod }) => {
{/* parent */} {/* parent */}
<div <div
className={`flex flex-row items-center justify-between px-3 py-4 border-b-2 ${ className={`flex flex-row items-center justify-between px-3 py-4 border-b-2 ${
activeAccordion === item activeAccordion === course
? "border-surfaceBorder " ? "border-surfaceBorder "
: "border-secondary" : "border-secondary"
} cursor-pointer`} } cursor-pointer`}
onClick={() => onClick={() =>
setActiveAccordion( setActiveAccordion(
activeAccordion === item ? null : item activeAccordion === course ? null : course
) )
} }
> >
@ -61,23 +61,23 @@ const AccordionDesign1 = ({ items, vod }) => {
parentClassName={"bg-secondary w-4 h-4 "} parentClassName={"bg-secondary w-4 h-4 "}
childClassName={false} childClassName={false}
/> />
<h2 className="flex-1 mr-5 text-sm">{item.title}</h2> <h2 className="flex-1 mr-5 text-sm">{course.title}</h2>
{vod && ( {vod && (
<div className="flex flex-row items-center ml-5 "> <div className="flex flex-row items-center ml-5 ">
<p className="text-xs"> <p className="text-xs">
دقیقه: دقیقه:
<span>{item.min}</span> <span>{course.min}</span>
</p> </p>
<div className="w-0.5 h-4 mx-2 bg-surfaceBorder"></div> <div className="w-0.5 h-4 mx-2 bg-surfaceBorder"></div>
<p className="text-xs"> <p className="text-xs">
ویدیو: ویدیو:
<span>{item.video}</span> <span>{course.video}</span>
</p> </p>
</div> </div>
)} )}
<img <img
src={ src={
activeAccordion === item activeAccordion === course
? `images/accordion-.svg` ? `images/accordion-.svg`
: `images/accordion+.svg` : `images/accordion+.svg`
} }
@ -86,8 +86,8 @@ const AccordionDesign1 = ({ items, vod }) => {
/> />
</div> </div>
{/* child */} {/* child */}
{activeAccordion === item && {activeAccordion === course &&
item.subItems.map((subItem, i) => ( course.lessons.map((lesson, i) => (
<div className="flex flex-row items-center justify-between p-3 border-b-2 border-surfaceBorder cursor-pointer transition-all duration-500 ease-in-out"> <div className="flex flex-row items-center justify-between p-3 border-b-2 border-surfaceBorder cursor-pointer transition-all duration-500 ease-in-out">
<div className="flex flex-row items-center"> <div className="flex flex-row items-center">
{vod === !true && ( {vod === !true && (
@ -106,14 +106,14 @@ const AccordionDesign1 = ({ items, vod }) => {
</span> </span>
</div> </div>
<div className="w-0.5 h-5 mx-3 bg-surfaceBorder"></div> <div className="w-0.5 h-5 mx-3 bg-surfaceBorder"></div>
<p className="text-sm flex-1">{subItem.name}</p> <p className="text-sm flex-1">{lesson.name}</p>
<div className="flex flex-row items-center justify-end gap-x-3 flex-1"> <div className="flex flex-row items-center justify-end gap-x-3 flex-1">
{vod ? ( {vod ? (
<> <>
<div className="flex flex-row items-center ml-7"> <div className="flex flex-row items-center ml-7">
<p className="text-xs"> <p className="text-xs">
دقیقه: دقیقه:
<span>{item.min}</span> <span>{course.min}</span>
</p> </p>
<Button <Button
className="px-2 py-1 text-primary text-sm border border-surfaceBorder rounded mr-4" className="px-2 py-1 text-primary text-sm border border-surfaceBorder rounded mr-4"
@ -155,13 +155,13 @@ export default AccordionDesign1;
AccordionDesign1.defaultProps = { AccordionDesign1.defaultProps = {
vod: false, vod: false,
items: [ courses: [
{ {
title: title:
"بخش اول: فصل اول جدایی و رهایی: آیا بازگشت نزدیک است؟ دیگران چه می گونید؟", "بخش اول: فصل اول جدایی و رهایی: آیا بازگشت نزدیک است؟ دیگران چه می گونید؟",
video: 4, video: 4,
min: 30, min: 30,
subItems: [ lessons: [
{ {
name: "چگونه با رژیم مناسب بدن سالم تری داشته باشیم؟", name: "چگونه با رژیم مناسب بدن سالم تری داشته باشیم؟",
}, },
@ -175,11 +175,10 @@ AccordionDesign1.defaultProps = {
}, },
{ {
title: title:
"بخش دوم: فصل اول جدایی و رهایی: آیا بازگشت نزدیک است؟ دیگران چه می گونید2؟", "بخش اول: فصل اول جدایی و رهایی: آیا بازگشت نزدیک است؟ دیگران چه می گونید؟",
video: 4, video: 4,
min: 30, min: 30,
lessons: [
subItems: [
{ {
name: "چگونه با رژیم مناسب بدن سالم تری داشته باشیم؟", name: "چگونه با رژیم مناسب بدن سالم تری داشته باشیم؟",
}, },
@ -193,10 +192,10 @@ AccordionDesign1.defaultProps = {
}, },
{ {
title: title:
"بخش سوم: فصل اول جدایی و رهایی: آیا بازگشت نزدیک است؟ دیگران چه می گونید3؟", "بخش اول: فصل اول جدایی و رهایی: آیا بازگشت نزدیک است؟ دیگران چه می گونید؟",
video: 4, video: 4,
min: 30, min: 30,
subItems: [ lessons: [
{ {
name: "چگونه با رژیم مناسب بدن سالم تری داشته باشیم؟", name: "چگونه با رژیم مناسب بدن سالم تری داشته باشیم؟",
}, },

16842
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save